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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 144 additions and 160 deletions

View file

@ -381,7 +381,7 @@ pub fn show_link_definition(
let Some((buffer, buffer_position)) = editor
.buffer
.read(cx)
.text_anchor_for_position(trigger_anchor.clone(), cx)
.text_anchor_for_position(*trigger_anchor, cx)
else {
return;
};
@ -389,7 +389,7 @@ pub fn show_link_definition(
let Some((excerpt_id, _, _)) = editor
.buffer()
.read(cx)
.excerpt_containing(trigger_anchor.clone(), cx)
.excerpt_containing(*trigger_anchor, cx)
else {
return;
};
@ -424,9 +424,8 @@ pub fn show_link_definition(
TriggerPoint::Text(_) => {
if let Some((url_range, url)) = find_url(&buffer, buffer_position, cx.clone()) {
this.update(&mut cx, |_, _| {
let start =
snapshot.anchor_in_excerpt(excerpt_id.clone(), url_range.start);
let end = snapshot.anchor_in_excerpt(excerpt_id.clone(), url_range.end);
let start = snapshot.anchor_in_excerpt(excerpt_id, url_range.start);
let end = snapshot.anchor_in_excerpt(excerpt_id, url_range.end);
(
Some(RangeInEditor::Text(start..end)),
vec![HoverLink::Url(url)],
@ -451,14 +450,10 @@ pub fn show_link_definition(
(
definition_result.iter().find_map(|link| {
link.origin.as_ref().map(|origin| {
let start = snapshot.anchor_in_excerpt(
excerpt_id.clone(),
origin.range.start,
);
let end = snapshot.anchor_in_excerpt(
excerpt_id.clone(),
origin.range.end,
);
let start = snapshot
.anchor_in_excerpt(excerpt_id, origin.range.start);
let end = snapshot
.anchor_in_excerpt(excerpt_id, origin.range.end);
RangeInEditor::Text(start..end)
})
}),