Fix clippy::redundant_clone
lint violations (#36558)
This removes around 900 unnecessary clones, ranging from cloning a few ints all the way to large data structures and images. A lot of these were fixed using `cargo clippy --fix --workspace --all-targets`, however it often breaks other lints and needs to be run again. This was then followed up with some manual fixing. I understand this is a large diff, but all the changes are pretty trivial. Rust is doing some heavy lifting here for us. Once I get it up to speed with main, I'd appreciate this getting merged rather sooner than later. Release Notes: - N/A
This commit is contained in:
parent
cf7c64d77f
commit
7bdc99abc1
306 changed files with 805 additions and 1102 deletions
|
@ -75,7 +75,6 @@ impl<T: PartialEq + 'static + Sync> TrackedFile<T> {
|
|||
{
|
||||
let parsed_contents: Arc<RwLock<T>> = Arc::default();
|
||||
cx.background_spawn({
|
||||
let parsed_contents = parsed_contents.clone();
|
||||
async move {
|
||||
while let Some(new_contents) = tracker.next().await {
|
||||
if Arc::strong_count(&parsed_contents) == 1 {
|
||||
|
|
|
@ -100,7 +100,7 @@ impl SpawnInTerminal {
|
|||
command: proto.command.clone(),
|
||||
args: proto.args.clone(),
|
||||
env: proto.env.into_iter().collect(),
|
||||
cwd: proto.cwd.map(PathBuf::from).clone(),
|
||||
cwd: proto.cwd.map(PathBuf::from),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,10 @@ impl TaskTemplate {
|
|||
&mut substituted_variables,
|
||||
)?
|
||||
} else {
|
||||
#[allow(
|
||||
clippy::redundant_clone,
|
||||
reason = "We want to clone the full_label to avoid borrowing it in the fold closure"
|
||||
)]
|
||||
full_label.clone()
|
||||
}
|
||||
.lines()
|
||||
|
@ -453,7 +457,7 @@ mod tests {
|
|||
TaskTemplate {
|
||||
label: "".to_string(),
|
||||
command: "".to_string(),
|
||||
..task_with_all_properties.clone()
|
||||
..task_with_all_properties
|
||||
},
|
||||
] {
|
||||
assert_eq!(
|
||||
|
@ -521,7 +525,7 @@ mod tests {
|
|||
);
|
||||
|
||||
let cx = TaskContext {
|
||||
cwd: Some(context_cwd.clone()),
|
||||
cwd: Some(context_cwd),
|
||||
task_variables: TaskVariables::default(),
|
||||
project_env: HashMap::default(),
|
||||
};
|
||||
|
@ -768,7 +772,7 @@ mod tests {
|
|||
"test_env_key".to_string(),
|
||||
format!("test_env_var_{}", VariableName::Symbol.template_value()),
|
||||
)]),
|
||||
..task_with_all_properties.clone()
|
||||
..task_with_all_properties
|
||||
},
|
||||
]
|
||||
.into_iter()
|
||||
|
@ -871,7 +875,7 @@ mod tests {
|
|||
|
||||
let context = TaskContext {
|
||||
cwd: None,
|
||||
task_variables: TaskVariables::from_iter(all_variables.clone()),
|
||||
task_variables: TaskVariables::from_iter(all_variables),
|
||||
project_env,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue