We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a705897 commit 4fdeb54Copy full SHA for 4fdeb54
crates/ra_assists/src/lib.rs
@@ -65,13 +65,11 @@ where
65
Assist::Unresolved(..) => unreachable!(),
66
})
67
.collect::<Vec<(AssistLabel, AssistAction)>>();
68
- a.sort_by(|a, b| match a {
69
- // Some(y) < Some(x) < None for y < x
70
- (_, AssistAction { target: Some(a), .. }) => match b {
71
- (_, AssistAction { target: Some(b), .. }) => a.len().cmp(&b.len()),
72
- _ => Ordering::Less,
73
- },
74
- _ => Ordering::Greater,
+ a.sort_by(|a, b| match (a.1.target, b.1.target) {
+ (Some(a), Some(b)) => a.len().cmp(&b.len()),
+ (Some(_), None) => Ordering::Less,
+ (None, Some(_)) => Ordering::Greater,
+ (None, None) => Ordering::Equal,
75
});
76
a
77
0 commit comments