diff --git a/testcontainers/src/core/client.rs b/testcontainers/src/core/client.rs index e39dcda8..e3313d7d 100644 --- a/testcontainers/src/core/client.rs +++ b/testcontainers/src/core/client.rs @@ -22,7 +22,7 @@ use url::Url; use crate::core::{ client::exec::ExecResult, - copy::{CopyToContaienrError, CopyToContainer}, + copy::{CopyToContainer, CopyToContainerError}, env, env::ConfigurationError, logs::{ @@ -91,7 +91,7 @@ pub enum ClientError { #[error("failed to upload data to container: {0}")] UploadToContainerError(BollardError), #[error("failed to prepare data for copy-to-container: {0}")] - CopyToContaienrError(CopyToContaienrError), + CopyToContainerError(CopyToContainerError), } /// The internal client. @@ -302,7 +302,7 @@ impl Client { let tar = copy_to_container .tar() .await - .map_err(ClientError::CopyToContaienrError)?; + .map_err(ClientError::CopyToContainerError)?; self.bollard .upload_to_container::(&container_id, Some(options), tar) diff --git a/testcontainers/src/core/copy.rs b/testcontainers/src/core/copy.rs index 3dc19ce8..2ca45068 100644 --- a/testcontainers/src/core/copy.rs +++ b/testcontainers/src/core/copy.rs @@ -16,7 +16,7 @@ pub enum CopyDataSource { } #[derive(Debug, thiserror::Error)] -pub enum CopyToContaienrError { +pub enum CopyToContainerError { #[error("io failed with error: {0}")] IoError(io::Error), #[error("failed to get the path name: {0}")] @@ -31,7 +31,7 @@ impl CopyToContainer { } } - pub(crate) async fn tar(&self) -> Result { + pub(crate) async fn tar(&self) -> Result { self.source.tar(&self.target).await } } @@ -56,7 +56,7 @@ impl CopyDataSource { pub(crate) async fn tar( &self, target_path: impl Into, - ) -> Result { + ) -> Result { let target_path: String = target_path.into(); let bytes = match self { @@ -73,37 +73,37 @@ impl CopyDataSource { async fn tar_file( source_file_path: &Path, target_path: &str, -) -> Result, CopyToContaienrError> { - let target_path = make_path_relative(&target_path); +) -> Result, CopyToContainerError> { + let target_path = make_path_relative(target_path); let meta = tokio::fs::metadata(source_file_path) .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; let mut ar = tokio_tar::Builder::new(Vec::new()); if meta.is_dir() { ar.append_dir_all(target_path, source_file_path) .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; } else { let f = &mut tokio::fs::File::open(source_file_path) .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; ar.append_file(target_path, f) .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; }; let res = ar .into_inner() .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; Ok(res) } -async fn tar_bytes(data: &Vec, target_path: &str) -> Result, CopyToContaienrError> { - let relative_target_path = make_path_relative(&target_path); +async fn tar_bytes(data: &Vec, target_path: &str) -> Result, CopyToContainerError> { + let relative_target_path = make_path_relative(target_path); let mut header = tokio_tar::Header::new_gnu(); header.set_size(data.len() as u64); @@ -113,12 +113,12 @@ async fn tar_bytes(data: &Vec, target_path: &str) -> Result, CopyToC let mut ar = tokio_tar::Builder::new(Vec::new()); ar.append_data(&mut header, relative_target_path, data.as_slice()) .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; let res = ar .into_inner() .await - .map_err(CopyToContaienrError::IoError)?; + .map_err(CopyToContainerError::IoError)?; Ok(res) } diff --git a/testcontainers/src/core/logs/consumer/logging_consumer.rs b/testcontainers/src/core/logs/consumer/logging_consumer.rs index b9216f1c..4f9ce383 100644 --- a/testcontainers/src/core/logs/consumer/logging_consumer.rs +++ b/testcontainers/src/core/logs/consumer/logging_consumer.rs @@ -44,7 +44,7 @@ impl LoggingConsumer { fn format_message<'a>(&self, message: &'a str) -> Cow<'a, str> { // Remove trailing newlines - let message = message.trim_end_matches(|c| c == '\n' || c == '\r'); + let message = message.trim_end_matches(['\n', '\r']); if let Some(prefix) = &self.prefix { Cow::Owned(format!("{} {}", prefix, message)) diff --git a/testcontainers/src/lib.rs b/testcontainers/src/lib.rs index 14b318a6..0e501e73 100644 --- a/testcontainers/src/lib.rs +++ b/testcontainers/src/lib.rs @@ -79,7 +79,7 @@ pub mod core; #[cfg_attr(docsrs, doc(cfg(feature = "blocking")))] pub use crate::core::Container; pub use crate::core::{ - copy::{CopyDataSource, CopyToContaienrError, CopyToContainer}, + copy::{CopyDataSource, CopyToContainer, CopyToContainerError}, error::TestcontainersError, ContainerAsync, ContainerRequest, Image, ImageExt, }; diff --git a/testimages/build.rs b/testimages/build.rs index 231d9b3c..39b56564 100644 --- a/testimages/build.rs +++ b/testimages/build.rs @@ -9,7 +9,7 @@ fn main() -> Result<()> { let output = Command::new("docker") .arg("build") .arg("--file") - .arg(&format!("{cwd}/src/dockerfiles/no_expose_port.dockerfile")) + .arg(format!("{cwd}/src/dockerfiles/no_expose_port.dockerfile")) .arg("--force-rm") .arg("--tag") .arg("no_expose_port:latest") @@ -24,7 +24,7 @@ fn main() -> Result<()> { let output = Command::new("docker") .arg("build") .arg("--file") - .arg(&format!( + .arg(format!( "{cwd}/src/dockerfiles/simple_web_server.dockerfile" )) .arg("--force-rm")