diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/lib.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index ce5ee365e..7928b4983 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -65,13 +65,11 @@ where | |||
65 | Assist::Unresolved(..) => unreachable!(), | 65 | Assist::Unresolved(..) => unreachable!(), |
66 | }) | 66 | }) |
67 | .collect::<Vec<(AssistLabel, AssistAction)>>(); | 67 | .collect::<Vec<(AssistLabel, AssistAction)>>(); |
68 | a.sort_by(|a, b| match a { | 68 | a.sort_by(|a, b| match (a.1.target, b.1.target) { |
69 | // Some(y) < Some(x) < None for y < x | 69 | (Some(a), Some(b)) => a.len().cmp(&b.len()), |
70 | (_, AssistAction { target: Some(a), .. }) => match b { | 70 | (Some(_), None) => Ordering::Less, |
71 | (_, AssistAction { target: Some(b), .. }) => a.len().cmp(&b.len()), | 71 | (None, Some(_)) => Ordering::Greater, |
72 | _ => Ordering::Less, | 72 | (None, None) => Ordering::Equal, |
73 | }, | ||
74 | _ => Ordering::Greater, | ||
75 | }); | 73 | }); |
76 | a | 74 | a |
77 | }) | 75 | }) |