about summary refs log tree commit diff
diff options
context:
space:
mode:
authordavidsemakula <hello@davidsemakula.com>2024-01-16 13:26:49 +0300
committerdavidsemakula <hello@davidsemakula.com>2024-01-16 13:26:49 +0300
commit5b2a2bc3fb44912c4a7277d44aaf8ff8489324ef (patch)
tree80172495ea2965be8943017c3297acd77426c215
parentd4b43d5a516009c67b8abcca3a399d554f4ba8aa (diff)
downloadrust-5b2a2bc3fb44912c4a7277d44aaf8ff8489324ef.tar.gz
rust-5b2a2bc3fb44912c4a7277d44aaf8ff8489324ef.zip
remove unnecessary ref patterns
-rw-r--r--crates/ide-db/src/imports/insert_use.rs4
-rw-r--r--crates/ide-db/src/imports/merge_imports.rs10
2 files changed, 6 insertions, 8 deletions
diff --git a/crates/ide-db/src/imports/insert_use.rs b/crates/ide-db/src/imports/insert_use.rs
index 8c9ced108aa..3a2ee921ea2 100644
--- a/crates/ide-db/src/imports/insert_use.rs
+++ b/crates/ide-db/src/imports/insert_use.rs
@@ -382,9 +382,7 @@ fn insert_use_(
         // find the element that would come directly after our new import
         let post_insert: Option<(_, _, SyntaxNode)> = group_iter
             .inspect(|(.., node)| last = Some(node.clone()))
-            .find(|&(_, ref use_tree, _)| {
-                use_tree_cmp(&insert_use_tree, use_tree) != Ordering::Greater
-            });
+            .find(|(_, use_tree, _)| use_tree_cmp(&insert_use_tree, use_tree) != Ordering::Greater);
 
         if let Some((.., node)) = post_insert {
             cov_mark::hit!(insert_group);
diff --git a/crates/ide-db/src/imports/merge_imports.rs b/crates/ide-db/src/imports/merge_imports.rs
index 52c94678ade..2aa26c2703d 100644
--- a/crates/ide-db/src/imports/merge_imports.rs
+++ b/crates/ide-db/src/imports/merge_imports.rs
@@ -263,7 +263,7 @@ fn use_tree_cmp_bin_search(lhs: &ast::UseTree, rhs: &ast::UseTree) -> Ordering {
         (Some(_), None) => Ordering::Greater,
         (None, Some(_)) if !lhs_is_simple_path => Ordering::Greater,
         (None, Some(_)) => Ordering::Less,
-        (Some(ref a), Some(ref b)) => path_segment_cmp(a, b),
+        (Some(a), Some(b)) => path_segment_cmp(&a, &b),
     }
 }
 
@@ -287,15 +287,15 @@ pub(super) fn use_tree_cmp(a: &ast::UseTree, b: &ast::UseTree) -> Ordering {
         (Some(_), None) => Ordering::Greater,
         (None, Some(_)) if !a_is_simple_path => Ordering::Greater,
         (None, Some(_)) => Ordering::Less,
-        (Some(ref a_path), Some(ref b_path)) => {
+        (Some(a_path), Some(b_path)) => {
             // cmp_by would be useful for us here but that is currently unstable
             // cmp doesn't work due the lifetimes on text's return type
             a_path
                 .segments()
                 .zip_longest(b_path.segments())
                 .find_map(|zipped| match zipped {
-                    EitherOrBoth::Both(ref a_segment, ref b_segment) => {
-                        match path_segment_cmp(a_segment, b_segment) {
+                    EitherOrBoth::Both(a_segment, b_segment) => {
+                        match path_segment_cmp(&a_segment, &b_segment) {
                             Ordering::Equal => None,
                             ord => Some(ord),
                         }
@@ -409,7 +409,7 @@ fn use_tree_cmp_by_tree_list_glob_or_alias(
             .use_trees()
             .zip_longest(b_list.use_trees())
             .find_map(|zipped| match zipped {
-                EitherOrBoth::Both(ref a_tree, ref b_tree) => match use_tree_cmp(a_tree, b_tree) {
+                EitherOrBoth::Both(a_tree, b_tree) => match use_tree_cmp(&a_tree, &b_tree) {
                     Ordering::Equal => None,
                     ord => Some(ord),
                 },