Skip to content

Commit 5b2a2bc

Browse files
committed
remove unnecessary ref patterns
1 parent d4b43d5 commit 5b2a2bc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

crates/ide-db/src/imports/insert_use.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,7 @@ fn insert_use_(
382382
// find the element that would come directly after our new import
383383
let post_insert: Option<(_, _, SyntaxNode)> = group_iter
384384
.inspect(|(.., node)| last = Some(node.clone()))
385-
.find(|&(_, ref use_tree, _)| {
386-
use_tree_cmp(&insert_use_tree, use_tree) != Ordering::Greater
387-
});
385+
.find(|(_, use_tree, _)| use_tree_cmp(&insert_use_tree, use_tree) != Ordering::Greater);
388386

389387
if let Some((.., node)) = post_insert {
390388
cov_mark::hit!(insert_group);

crates/ide-db/src/imports/merge_imports.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fn use_tree_cmp_bin_search(lhs: &ast::UseTree, rhs: &ast::UseTree) -> Ordering {
263263
(Some(_), None) => Ordering::Greater,
264264
(None, Some(_)) if !lhs_is_simple_path => Ordering::Greater,
265265
(None, Some(_)) => Ordering::Less,
266-
(Some(ref a), Some(ref b)) => path_segment_cmp(a, b),
266+
(Some(a), Some(b)) => path_segment_cmp(&a, &b),
267267
}
268268
}
269269

@@ -287,15 +287,15 @@ pub(super) fn use_tree_cmp(a: &ast::UseTree, b: &ast::UseTree) -> Ordering {
287287
(Some(_), None) => Ordering::Greater,
288288
(None, Some(_)) if !a_is_simple_path => Ordering::Greater,
289289
(None, Some(_)) => Ordering::Less,
290-
(Some(ref a_path), Some(ref b_path)) => {
290+
(Some(a_path), Some(b_path)) => {
291291
// cmp_by would be useful for us here but that is currently unstable
292292
// cmp doesn't work due the lifetimes on text's return type
293293
a_path
294294
.segments()
295295
.zip_longest(b_path.segments())
296296
.find_map(|zipped| match zipped {
297-
EitherOrBoth::Both(ref a_segment, ref b_segment) => {
298-
match path_segment_cmp(a_segment, b_segment) {
297+
EitherOrBoth::Both(a_segment, b_segment) => {
298+
match path_segment_cmp(&a_segment, &b_segment) {
299299
Ordering::Equal => None,
300300
ord => Some(ord),
301301
}
@@ -409,7 +409,7 @@ fn use_tree_cmp_by_tree_list_glob_or_alias(
409409
.use_trees()
410410
.zip_longest(b_list.use_trees())
411411
.find_map(|zipped| match zipped {
412-
EitherOrBoth::Both(ref a_tree, ref b_tree) => match use_tree_cmp(a_tree, b_tree) {
412+
EitherOrBoth::Both(a_tree, b_tree) => match use_tree_cmp(&a_tree, &b_tree) {
413413
Ordering::Equal => None,
414414
ord => Some(ord),
415415
},

0 commit comments

Comments
 (0)