aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/inlay_hints.rs9
-rw-r--r--crates/ra_ide/src/join_lines.rs5
-rw-r--r--crates/ra_ide/src/syntax_highlighting/tags.rs4
3 files changed, 7 insertions, 11 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 3fd08b1e8..c87652555 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -258,6 +258,7 @@ fn should_show_param_name_hint(
258 if param_name.is_empty() 258 if param_name.is_empty()
259 || Some(param_name) == fn_signature.name.as_ref().map(|s| s.trim_start_matches('_')) 259 || Some(param_name) == fn_signature.name.as_ref().map(|s| s.trim_start_matches('_'))
260 || is_argument_similar_to_param_name(sema, argument, param_name) 260 || is_argument_similar_to_param_name(sema, argument, param_name)
261 || param_name.starts_with("ra_fixture")
261 { 262 {
262 return false; 263 return false;
263 } 264 }
@@ -270,7 +271,7 @@ fn should_show_param_name_hint(
270 271
271 // avoid displaying hints for common functions like map, filter, etc. 272 // avoid displaying hints for common functions like map, filter, etc.
272 // or other obvious words used in std 273 // or other obvious words used in std
273 parameters_len != 1 || !is_obvious_param(param_name) 274 !(parameters_len == 1 && is_obvious_param(param_name))
274} 275}
275 276
276fn is_argument_similar_to_param_name( 277fn is_argument_similar_to_param_name(
@@ -312,10 +313,8 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
312} 313}
313 314
314fn is_obvious_param(param_name: &str) -> bool { 315fn is_obvious_param(param_name: &str) -> bool {
315 let is_obvious_param_name = match param_name { 316 let is_obvious_param_name =
316 "predicate" | "value" | "pat" | "rhs" | "other" => true, 317 matches!(param_name, "predicate" | "value" | "pat" | "rhs" | "other");
317 _ => false,
318 };
319 param_name.len() == 1 || is_obvious_param_name 318 param_name.len() == 1 || is_obvious_param_name
320} 319}
321 320
diff --git a/crates/ra_ide/src/join_lines.rs b/crates/ra_ide/src/join_lines.rs
index 5036c1fb0..6907c09e8 100644
--- a/crates/ra_ide/src/join_lines.rs
+++ b/crates/ra_ide/src/join_lines.rs
@@ -165,10 +165,7 @@ fn join_single_use_tree(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Opti
165} 165}
166 166
167fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool { 167fn is_trailing_comma(left: SyntaxKind, right: SyntaxKind) -> bool {
168 match (left, right) { 168 matches!((left, right), (T![,], T![')']) | (T![,], T![']']))
169 (T![,], T![')']) | (T![,], T![']']) => true,
170 _ => false,
171 }
172} 169}
173 170
174#[cfg(test)] 171#[cfg(test)]
diff --git a/crates/ra_ide/src/syntax_highlighting/tags.rs b/crates/ra_ide/src/syntax_highlighting/tags.rs
index e8e251cfc..13d9dd195 100644
--- a/crates/ra_ide/src/syntax_highlighting/tags.rs
+++ b/crates/ra_ide/src/syntax_highlighting/tags.rs
@@ -25,7 +25,6 @@ pub enum HighlightTag {
25 EnumVariant, 25 EnumVariant,
26 EscapeSequence, 26 EscapeSequence,
27 Field, 27 Field,
28 FormatSpecifier,
29 Function, 28 Function,
30 Generic, 29 Generic,
31 Keyword, 30 Keyword,
@@ -33,7 +32,6 @@ pub enum HighlightTag {
33 Macro, 32 Macro,
34 Module, 33 Module,
35 NumericLiteral, 34 NumericLiteral,
36 Operator,
37 SelfKeyword, 35 SelfKeyword,
38 SelfType, 36 SelfType,
39 Static, 37 Static,
@@ -45,6 +43,8 @@ pub enum HighlightTag {
45 Union, 43 Union,
46 Local, 44 Local,
47 UnresolvedReference, 45 UnresolvedReference,
46 FormatSpecifier,
47 Operator,
48} 48}
49 49
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] 50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]