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
|
@ -974,8 +974,6 @@ impl Buffer {
|
|||
TextBuffer::new_normalized(0, buffer_id, Default::default(), text).snapshot();
|
||||
let mut syntax = SyntaxMap::new(&text).snapshot();
|
||||
if let Some(language) = language.clone() {
|
||||
let text = text.clone();
|
||||
let language = language.clone();
|
||||
let language_registry = language_registry.clone();
|
||||
syntax.reparse(&text, language_registry, language);
|
||||
}
|
||||
|
@ -1020,9 +1018,6 @@ impl Buffer {
|
|||
let text = TextBuffer::new_normalized(0, buffer_id, Default::default(), text).snapshot();
|
||||
let mut syntax = SyntaxMap::new(&text).snapshot();
|
||||
if let Some(language) = language.clone() {
|
||||
let text = text.clone();
|
||||
let language = language.clone();
|
||||
let language_registry = language_registry.clone();
|
||||
syntax.reparse(&text, language_registry, language);
|
||||
}
|
||||
BufferSnapshot {
|
||||
|
@ -2206,7 +2201,7 @@ impl Buffer {
|
|||
self.remote_selections.insert(
|
||||
AGENT_REPLICA_ID,
|
||||
SelectionSet {
|
||||
selections: selections.clone(),
|
||||
selections,
|
||||
lamport_timestamp,
|
||||
line_mode,
|
||||
cursor_shape,
|
||||
|
@ -3006,9 +3001,9 @@ impl BufferSnapshot {
|
|||
}
|
||||
|
||||
let mut error_ranges = Vec::<Range<Point>>::new();
|
||||
let mut matches = self.syntax.matches(range.clone(), &self.text, |grammar| {
|
||||
grammar.error_query.as_ref()
|
||||
});
|
||||
let mut matches = self
|
||||
.syntax
|
||||
.matches(range, &self.text, |grammar| grammar.error_query.as_ref());
|
||||
while let Some(mat) = matches.peek() {
|
||||
let node = mat.captures[0].node;
|
||||
let start = Point::from_ts_point(node.start_position());
|
||||
|
@ -4075,7 +4070,7 @@ impl BufferSnapshot {
|
|||
// Get the ranges of the innermost pair of brackets.
|
||||
let mut result: Option<(Range<usize>, Range<usize>)> = None;
|
||||
|
||||
for pair in self.enclosing_bracket_ranges(range.clone()) {
|
||||
for pair in self.enclosing_bracket_ranges(range) {
|
||||
if let Some(range_filter) = range_filter
|
||||
&& !range_filter(pair.open_range.clone(), pair.close_range.clone())
|
||||
{
|
||||
|
@ -4248,7 +4243,7 @@ impl BufferSnapshot {
|
|||
.map(|(range, name)| {
|
||||
(
|
||||
name.to_string(),
|
||||
self.text_for_range(range.clone()).collect::<String>(),
|
||||
self.text_for_range(range).collect::<String>(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue