Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,9 @@ members = ["tests/integration/randomize_readdir"]
harness = false
name = "sccache_bench"
test = false

[lints]
workspace = true

[workspace.lints.clippy]
implicit_clone = "warn"
14 changes: 7 additions & 7 deletions src/compiler/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ where
// Create an argument vector containing both preprocessor and arch args, to
// use in creating a hash key
let mut preprocessor_and_arch_args = self.parsed_args.preprocessor_args.clone();
preprocessor_and_arch_args.extend(self.parsed_args.arch_args.to_vec());
preprocessor_and_arch_args.extend(self.parsed_args.arch_args.clone());
// common_args is used in preprocessing too
preprocessor_and_arch_args.extend(self.parsed_args.common_args.to_vec());
preprocessor_and_arch_args.extend(self.parsed_args.common_args.clone());

let absolute_input_path: Cow<'_, _> = if self.parsed_args.input.is_absolute() {
Cow::Borrowed(&self.parsed_args.input)
Expand Down Expand Up @@ -508,15 +508,15 @@ where
return Ok(HashResult {
key,
compilation: Box::new(CCompilation {
parsed_args: self.parsed_args.to_owned(),
parsed_args: self.parsed_args.clone(),
is_locally_preprocessed: false,
#[cfg(feature = "dist-client")]
preprocessed_input: PREPROCESSING_SKIPPED_COMPILE_POISON
.to_vec(),
executable: self.executable.to_owned(),
executable: self.executable.clone(),
compiler: self.compiler.to_owned(),
cwd: cwd.to_owned(),
env_vars: env_vars.to_owned(),
cwd: cwd.clone(),
env_vars: env_vars.clone(),
}),
weak_toolchain_key,
});
Expand Down Expand Up @@ -622,7 +622,7 @@ where
// Create an argument vector containing both common and arch args, to
// use in creating a hash key
let mut common_and_arch_args = self.parsed_args.common_args.clone();
common_and_arch_args.extend(self.parsed_args.arch_args.to_vec());
common_and_arch_args.extend(self.parsed_args.arch_args.clone());

let key = HashKeyParams::new(
&self.executable_digest,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl CompileCommandImpl for SingleCompileCommand {
let mut cmd = creator.clone().new_command_sync(executable);
cmd.args(arguments)
.env_clear()
.envs(env_vars.to_vec())
.envs(env_vars.clone())
.current_dir(cwd);
run_input_output(cmd, None).await
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ mod test {
o => panic!("Got unexpected parse result: {:?}", o),
};
let mut common_and_arch_args = common_args.clone();
common_and_arch_args.extend(common_args.to_vec());
common_and_arch_args.extend(common_args.clone());
debug!("common_and_arch_args: {:?}", common_and_arch_args);
assert_eq!(Some("foo.cpp"), input.to_str());
assert_eq!(Language::Cxx, language);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ pub fn parse_arguments(
}
let (input, language) = match input_arg {
Some(i) => match Language::from_file_name(Path::new(&i)) {
Some(l) => (i.to_owned(), l),
Some(l) => (i.clone(), l),
None => cannot_cache!("unknown source language"),
},
// We can't cache compilation without an input.
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/nvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ where
// * .cpp1.ii - cicc/ptxas input
// * .cpp4.ii - cudafe++ input
if out_name.ends_with(".cpp1.ii") {
Some(out_name.to_owned())
Some(out_name.clone())
} else {
None
}
Expand Down Expand Up @@ -944,7 +944,7 @@ where
.args(&[arguments, &["--dryrun".into(), "--keep".into()][..]].concat())
.env_clear()
.current_dir(cwd)
.envs(env_vars.to_vec());
.envs(env_vars.clone());

let nvcc_dryrun_output = run_input_output(nvcc_dryrun_cmd, None).await?;

Expand Down Expand Up @@ -1250,7 +1250,7 @@ where
cwd,
[
vec![exe.clone().into_os_string().into_string().unwrap()],
args.to_vec()
args.clone()
]
.concat()
.join(" ")
Expand All @@ -1264,7 +1264,7 @@ where
cmd.args(args)
.current_dir(cwd)
.env_clear()
.envs(env_vars.to_vec());
.envs(env_vars.clone());

run_input_output(cmd, None)
.await
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/preprocessor_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl PreprocessorCacheEntry {
for (digest, includes) in self.results.iter_mut().rev() {
let result_matches = Self::result_matches(digest, includes, config, updated);
if result_matches {
return Some(digest.to_string());
return Some(digest.clone());
}
}
None
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments<Pars
match (opt.as_ref(), value) {
("extra-filename", Some(value)) => extra_filename = Some(value.to_owned()),
("extra-filename", None) => cannot_cache!("extra-filename"),
("profile-use", Some(v)) => profile = Some(v.to_string()),
("profile-use", Some(v)) => profile = Some(v.clone()),
// Incremental compilation makes a mess of sccache's entire world
// view. It produces additional compiler outputs that we don't cache,
// and just letting rustc do its work in incremental mode is likely
Expand Down Expand Up @@ -1887,7 +1887,7 @@ impl<T: CommandCreatorSync> Compilation<T> for RustCompilation {

fn outputs<'a>(&'a self) -> Box<dyn Iterator<Item = FileObjectSource> + 'a> {
Box::new(self.outputs.iter().map(|(k, v)| FileObjectSource {
key: k.to_string(),
key: k.clone(),
path: v.path.clone(),
optional: v.optional,
}))
Expand Down
4 changes: 2 additions & 2 deletions src/dist/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,8 +1314,8 @@ mod client {
weak_key: String,
toolchain_packager: Box<dyn ToolchainPackager>,
) -> Result<(Toolchain, Option<(String, PathBuf)>)> {
let compiler_path = compiler_path.to_owned();
let weak_key = weak_key.to_owned();
let compiler_path = compiler_path.clone();
let weak_key = weak_key.clone();
let tc_cache = self.tc_cache.clone();

self.pool
Expand Down
2 changes: 1 addition & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ pub fn start_server(config: &Config, addr: &crate::net::SocketAddr) -> Result<()
SccacheServer::<_>::with_listener(l, runtime, client, dist_client, storage);
Ok((
srv.local_addr()
.unwrap_or_else(|| crate::net::SocketAddr::UnixAbstract(p.to_vec())),
.unwrap_or_else(|| crate::net::SocketAddr::UnixAbstract(p.clone())),
Box::new(move |f| srv.run(f)) as Box<dyn FnOnce(_) -> _>,
))
}
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl TimeMacroFinder {
}
// Also check the concatenation with the previous small read
if !self.previous_small_read.is_empty() {
let mut concatenated = self.previous_small_read.to_owned();
let mut concatenated = self.previous_small_read.clone();
concatenated.extend(visit);
self.find_macros(&concatenated);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl SccacheTest<'_> {

Ok(SccacheTest {
tempdir,
env: env.to_owned(),
env: env.clone(),
})
}

Expand Down
Loading