Skip to content

Commit 96e0440

Browse files
committed
cargo fmt ✨
1 parent e327ecc commit 96e0440

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

testcontainers/src/core/client.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,19 @@ impl Client {
445445
Ok(())
446446
}
447447

448-
pub(crate) async fn pull_image(&self, descriptor: &str, platform: Option<String>) -> Result<(), ClientError> {
449-
let mut pull_options = CreateImageOptionsBuilder::new()
450-
.from_image(descriptor);
451-
448+
pub(crate) async fn pull_image(
449+
&self,
450+
descriptor: &str,
451+
platform: Option<String>,
452+
) -> Result<(), ClientError> {
453+
let mut pull_options = CreateImageOptionsBuilder::new().from_image(descriptor);
454+
452455
if let Some(platform) = platform {
453456
pull_options = pull_options.platform(&platform);
454457
}
455-
458+
456459
let pull_options = pull_options.build();
457-
460+
458461
let credentials = self.credentials_for_image(descriptor).await;
459462
let mut pulling = self
460463
.bollard

testcontainers/src/core/image/image_ext.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ pub trait ImageExt<I: Image> {
6565

6666
/// Sets the container name.
6767
fn with_container_name(self, name: impl Into<String>) -> ContainerRequest<I>;
68-
68+
6969
/// Sets the platform the container will be run on.
70-
///
70+
///
7171
/// Platform in the format `os[/arch[/variant]]` used for image lookup.
72-
///
72+
///
7373
/// # Examples
74-
///
74+
///
7575
/// ```rust,no_run
7676
/// use testcontainers::{GenericImage, ImageExt};
77-
///
77+
///
7878
/// let image = GenericImage::new("image", "tag")
7979
/// .with_platform("linux/amd64");
8080
/// ```
@@ -254,7 +254,7 @@ impl<RI: Into<ContainerRequest<I>>, I: Image> ImageExt<I> for RI {
254254
..container_req
255255
}
256256
}
257-
257+
258258
fn with_platform(self, platform: impl Into<String>) -> ContainerRequest<I> {
259259
let container_req = self.into();
260260

testcontainers/src/runners/async_runner.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,21 @@ where
176176
} else {
177177
None
178178
};
179-
179+
180180
let mut options_builder: Option<CreateContainerOptionsBuilder> = None;
181181

182182
// name of the container
183183
if let Some(name) = container_req.container_name() {
184184
let options = CreateContainerOptionsBuilder::new().name(name);
185185
options_builder = Some(options);
186186
}
187-
187+
188188
// platform of the container
189189
if let Some(platform) = container_req.platform() {
190190
let options = options_builder.unwrap_or(CreateContainerOptionsBuilder::new());
191191
options_builder = Some(options.platform(platform));
192192
}
193-
193+
194194
if let Some(options) = options_builder {
195195
create_options = Some(options.build());
196196
}
@@ -299,7 +299,12 @@ where
299299
status_code: 404, ..
300300
},
301301
)) => {
302-
client.pull_image(&container_req.descriptor(), container_req.platform().clone()).await?;
302+
client
303+
.pull_image(
304+
&container_req.descriptor(),
305+
container_req.platform().clone(),
306+
)
307+
.await?;
303308
client.create_container(create_options, config).await
304309
}
305310
res => res,
@@ -342,7 +347,12 @@ where
342347
async fn pull_image(self) -> Result<ContainerRequest<I>> {
343348
let container_req = self.into();
344349
let client = Client::lazy_client().await?;
345-
client.pull_image(&container_req.descriptor(), container_req.platform().clone()).await?;
350+
client
351+
.pull_image(
352+
&container_req.descriptor(),
353+
container_req.platform().clone(),
354+
)
355+
.await?;
346356

347357
Ok(container_req)
348358
}

0 commit comments

Comments
 (0)