mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
fix: Show parameter hints unconditionally for logical not expressions
This commit is contained in:
parent
82abe04931
commit
76022bfd60
1 changed files with 8 additions and 4 deletions
|
@ -1,11 +1,10 @@
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo};
|
use hir::{known, Callable, HasVisibility, HirDisplay, Semantics, TypeInfo};
|
||||||
use ide_db::RootDatabase;
|
use ide_db::{base_db::FileRange, helpers::FamousDefs, RootDatabase};
|
||||||
use ide_db::{base_db::FileRange, helpers::FamousDefs};
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use stdx::to_lower_snake_case;
|
use stdx::to_lower_snake_case;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, AstNode, HasArgList, HasName},
|
ast::{self, AstNode, HasArgList, HasName, UnaryOp},
|
||||||
match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
|
match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -421,6 +420,10 @@ fn should_hide_param_name_hint(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matches!(argument, ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(UnaryOp::Not)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let fn_name = match callable.kind() {
|
let fn_name = match callable.kind() {
|
||||||
hir::CallableKind::Function(it) => Some(it.name(sema.db).to_smol_str()),
|
hir::CallableKind::Function(it) => Some(it.name(sema.db).to_smol_str()),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -868,7 +871,8 @@ fn non_ident_pat((a, b): (u32, u32)) {}
|
||||||
fn main() {
|
fn main() {
|
||||||
const PARAM: u32 = 0;
|
const PARAM: u32 = 0;
|
||||||
foo(PARAM);
|
foo(PARAM);
|
||||||
|
foo(!PARAM);
|
||||||
|
// ^^^^^^ param
|
||||||
check("");
|
check("");
|
||||||
|
|
||||||
map(0);
|
map(0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue