Enable clippy::clone_on_copy (#8728)

This PR enables the
[`clippy::clone_on_copy`](https://rust-lang.github.io/rust-clippy/master/index.html#/clone_on_copy)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2024-03-02 17:37:48 -05:00
committed by GitHub
parent 5935681c5c
commit 9735912965
42 changed files with 144 additions and 160 deletions
+10 -10
View File
@@ -884,10 +884,10 @@ impl sum_tree::Item for Fold {
fn summary(&self) -> Self::Summary {
FoldSummary {
start: self.range.start.clone(),
end: self.range.end.clone(),
min_start: self.range.start.clone(),
max_end: self.range.end.clone(),
start: self.range.start,
end: self.range.end,
min_start: self.range.start,
max_end: self.range.end,
count: 1,
}
}
@@ -919,10 +919,10 @@ impl sum_tree::Summary for FoldSummary {
fn add_summary(&mut self, other: &Self, buffer: &Self::Context) {
if other.min_start.cmp(&self.min_start, buffer) == Ordering::Less {
self.min_start = other.min_start.clone();
self.min_start = other.min_start;
}
if other.max_end.cmp(&self.max_end, buffer) == Ordering::Greater {
self.max_end = other.max_end.clone();
self.max_end = other.max_end;
}
#[cfg(debug_assertions)]
@@ -934,16 +934,16 @@ impl sum_tree::Summary for FoldSummary {
}
}
self.start = other.start.clone();
self.end = other.end.clone();
self.start = other.start;
self.end = other.end;
self.count += other.count;
}
}
impl<'a> sum_tree::Dimension<'a, FoldSummary> for FoldRange {
fn add_summary(&mut self, summary: &'a FoldSummary, _: &MultiBufferSnapshot) {
self.0.start = summary.start.clone();
self.0.end = summary.end.clone();
self.0.start = summary.start;
self.0.end = summary.end;
}
}
+2 -2
View File
@@ -283,7 +283,7 @@ impl<'a> Iterator for InlayChunks<'a> {
self.output_offset.0 += prefix.len();
let mut prefix = Chunk {
text: prefix,
..chunk.clone()
..*chunk
};
if !self.active_highlights.is_empty() {
let mut highlight_style = HighlightStyle::default();
@@ -322,7 +322,7 @@ impl<'a> Iterator for InlayChunks<'a> {
next_inlay_highlight_endpoint = range.end - offset_in_inlay.0;
highlight_style
.get_or_insert_with(|| Default::default())
.highlight(style.clone());
.highlight(*style);
}
} else {
next_inlay_highlight_endpoint = usize::MAX;