Skip to content

Commit c47a2a9

Browse files
authored
fix: typo in an error variant (#738)
1 parent ece5002 commit c47a2a9

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

testcontainers/src/core/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use url::Url;
2222

2323
use crate::core::{
2424
client::exec::ExecResult,
25-
copy::{CopyToContaienrError, CopyToContainer},
25+
copy::{CopyToContainer, CopyToContainerError},
2626
env,
2727
env::ConfigurationError,
2828
logs::{
@@ -91,7 +91,7 @@ pub enum ClientError {
9191
#[error("failed to upload data to container: {0}")]
9292
UploadToContainerError(BollardError),
9393
#[error("failed to prepare data for copy-to-container: {0}")]
94-
CopyToContaienrError(CopyToContaienrError),
94+
CopyToContainerError(CopyToContainerError),
9595
}
9696

9797
/// The internal client.
@@ -302,7 +302,7 @@ impl Client {
302302
let tar = copy_to_container
303303
.tar()
304304
.await
305-
.map_err(ClientError::CopyToContaienrError)?;
305+
.map_err(ClientError::CopyToContainerError)?;
306306

307307
self.bollard
308308
.upload_to_container::<String>(&container_id, Some(options), tar)

testcontainers/src/core/copy.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum CopyDataSource {
1616
}
1717

1818
#[derive(Debug, thiserror::Error)]
19-
pub enum CopyToContaienrError {
19+
pub enum CopyToContainerError {
2020
#[error("io failed with error: {0}")]
2121
IoError(io::Error),
2222
#[error("failed to get the path name: {0}")]
@@ -31,7 +31,7 @@ impl CopyToContainer {
3131
}
3232
}
3333

34-
pub(crate) async fn tar(&self) -> Result<bytes::Bytes, CopyToContaienrError> {
34+
pub(crate) async fn tar(&self) -> Result<bytes::Bytes, CopyToContainerError> {
3535
self.source.tar(&self.target).await
3636
}
3737
}
@@ -56,7 +56,7 @@ impl CopyDataSource {
5656
pub(crate) async fn tar(
5757
&self,
5858
target_path: impl Into<String>,
59-
) -> Result<bytes::Bytes, CopyToContaienrError> {
59+
) -> Result<bytes::Bytes, CopyToContainerError> {
6060
let target_path: String = target_path.into();
6161

6262
let bytes = match self {
@@ -73,37 +73,37 @@ impl CopyDataSource {
7373
async fn tar_file(
7474
source_file_path: &Path,
7575
target_path: &str,
76-
) -> Result<Vec<u8>, CopyToContaienrError> {
77-
let target_path = make_path_relative(&target_path);
76+
) -> Result<Vec<u8>, CopyToContainerError> {
77+
let target_path = make_path_relative(target_path);
7878
let meta = tokio::fs::metadata(source_file_path)
7979
.await
80-
.map_err(CopyToContaienrError::IoError)?;
80+
.map_err(CopyToContainerError::IoError)?;
8181

8282
let mut ar = tokio_tar::Builder::new(Vec::new());
8383
if meta.is_dir() {
8484
ar.append_dir_all(target_path, source_file_path)
8585
.await
86-
.map_err(CopyToContaienrError::IoError)?;
86+
.map_err(CopyToContainerError::IoError)?;
8787
} else {
8888
let f = &mut tokio::fs::File::open(source_file_path)
8989
.await
90-
.map_err(CopyToContaienrError::IoError)?;
90+
.map_err(CopyToContainerError::IoError)?;
9191

9292
ar.append_file(target_path, f)
9393
.await
94-
.map_err(CopyToContaienrError::IoError)?;
94+
.map_err(CopyToContainerError::IoError)?;
9595
};
9696

9797
let res = ar
9898
.into_inner()
9999
.await
100-
.map_err(CopyToContaienrError::IoError)?;
100+
.map_err(CopyToContainerError::IoError)?;
101101

102102
Ok(res)
103103
}
104104

105-
async fn tar_bytes(data: &Vec<u8>, target_path: &str) -> Result<Vec<u8>, CopyToContaienrError> {
106-
let relative_target_path = make_path_relative(&target_path);
105+
async fn tar_bytes(data: &Vec<u8>, target_path: &str) -> Result<Vec<u8>, CopyToContainerError> {
106+
let relative_target_path = make_path_relative(target_path);
107107

108108
let mut header = tokio_tar::Header::new_gnu();
109109
header.set_size(data.len() as u64);
@@ -113,12 +113,12 @@ async fn tar_bytes(data: &Vec<u8>, target_path: &str) -> Result<Vec<u8>, CopyToC
113113
let mut ar = tokio_tar::Builder::new(Vec::new());
114114
ar.append_data(&mut header, relative_target_path, data.as_slice())
115115
.await
116-
.map_err(CopyToContaienrError::IoError)?;
116+
.map_err(CopyToContainerError::IoError)?;
117117

118118
let res = ar
119119
.into_inner()
120120
.await
121-
.map_err(CopyToContaienrError::IoError)?;
121+
.map_err(CopyToContainerError::IoError)?;
122122

123123
Ok(res)
124124
}

testcontainers/src/core/logs/consumer/logging_consumer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl LoggingConsumer {
4444

4545
fn format_message<'a>(&self, message: &'a str) -> Cow<'a, str> {
4646
// Remove trailing newlines
47-
let message = message.trim_end_matches(|c| c == '\n' || c == '\r');
47+
let message = message.trim_end_matches(['\n', '\r']);
4848

4949
if let Some(prefix) = &self.prefix {
5050
Cow::Owned(format!("{} {}", prefix, message))

testcontainers/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub mod core;
7979
#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
8080
pub use crate::core::Container;
8181
pub use crate::core::{
82-
copy::{CopyDataSource, CopyToContaienrError, CopyToContainer},
82+
copy::{CopyDataSource, CopyToContainer, CopyToContainerError},
8383
error::TestcontainersError,
8484
ContainerAsync, ContainerRequest, Image, ImageExt,
8585
};

testimages/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() -> Result<()> {
99
let output = Command::new("docker")
1010
.arg("build")
1111
.arg("--file")
12-
.arg(&format!("{cwd}/src/dockerfiles/no_expose_port.dockerfile"))
12+
.arg(format!("{cwd}/src/dockerfiles/no_expose_port.dockerfile"))
1313
.arg("--force-rm")
1414
.arg("--tag")
1515
.arg("no_expose_port:latest")
@@ -24,7 +24,7 @@ fn main() -> Result<()> {
2424
let output = Command::new("docker")
2525
.arg("build")
2626
.arg("--file")
27-
.arg(&format!(
27+
.arg(format!(
2828
"{cwd}/src/dockerfiles/simple_web_server.dockerfile"
2929
))
3030
.arg("--force-rm")

0 commit comments

Comments
 (0)