Merge #7465
7465: Only hide parameter hints for path, field and methodcall expressions r=SomeoneToIgnore a=Veykril Doing this check for other expressions makes little sense to me. Fixes #7458 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
c76cab6247
1 changed files with 19 additions and 1 deletions
|
@ -416,8 +416,11 @@ fn get_string_representation(expr: &ast::Expr) -> Option<String> {
|
|||
name_ref => Some(name_ref.to_owned()),
|
||||
}
|
||||
}
|
||||
ast::Expr::FieldExpr(field_expr) => Some(field_expr.name_ref()?.to_string()),
|
||||
ast::Expr::PathExpr(path_expr) => Some(path_expr.to_string()),
|
||||
ast::Expr::PrefixExpr(prefix_expr) => get_string_representation(&prefix_expr.expr()?),
|
||||
ast::Expr::RefExpr(ref_expr) => get_string_representation(&ref_expr.expr()?),
|
||||
_ => Some(expr.to_string()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1438,4 +1441,19 @@ fn main() {
|
|||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn param_name_hints_show_for_literals() {
|
||||
check(
|
||||
r#"pub fn test(a: i32, b: i32) -> [i32; 2] { [a, b] }
|
||||
fn main() {
|
||||
test(
|
||||
0x0fab272b,
|
||||
//^^^^^^^^^^ a
|
||||
0x0fab272b
|
||||
//^^^^^^^^^^ b
|
||||
);
|
||||
}"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue