mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
remove unnecessary ref patterns
This commit is contained in:
parent
d4b43d5a51
commit
5b2a2bc3fb
2 changed files with 6 additions and 8 deletions
|
@ -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);
|
||||
|
|
|
@ -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),
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue