Skip to content

Commit

Permalink
Prefer Into<PathBuf> over AsRef<Path>
Browse files Browse the repository at this point in the history
We need to store the `PathBuf` so this avoids the explicit `as_ref().to_path_buf()` conversion.
  • Loading branch information
runesoerensen committed Oct 22, 2024
1 parent 9987b8a commit 81868f0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libcnb-test/src/container_config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use std::path::PathBuf;

/// Config used when starting a container.
///
Expand Down Expand Up @@ -194,11 +194,12 @@ impl ContainerConfig {
/// },
/// );
/// ```
pub fn volume(&mut self, source: impl AsRef<Path>, destination: impl AsRef<Path>) -> &mut Self {
self.volumes.insert(
source.as_ref().to_path_buf(),
destination.as_ref().to_path_buf(),
);
pub fn volume(
&mut self,
source: impl Into<PathBuf>,
destination: impl Into<PathBuf>,
) -> &mut Self {
self.volumes.insert(source.into(), destination.into());
self
}

Expand Down

0 comments on commit 81868f0

Please sign in to comment.