mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
single_match
This commit is contained in:
parent
9dd07f0bc4
commit
b1a0c9ac40
14 changed files with 89 additions and 130 deletions
|
@ -114,34 +114,26 @@ impl ExprValidator {
|
|||
) {
|
||||
// Check that the number of arguments matches the number of parameters.
|
||||
|
||||
// FIXME: Due to shortcomings in the current type system implementation, only emit this
|
||||
// diagnostic if there are no type mismatches in the containing function.
|
||||
if self.infer.expr_type_mismatches().next().is_some() {
|
||||
return;
|
||||
}
|
||||
// FIXME: Due to shortcomings in the current type system implementation, only emit
|
||||
// this diagnostic if there are no type mismatches in the containing function.
|
||||
} else if let Expr::MethodCall { receiver, .. } = expr {
|
||||
let (callee, _) = match self.infer.method_resolution(call_id) {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
};
|
||||
|
||||
match expr {
|
||||
Expr::MethodCall { receiver, .. } => {
|
||||
let (callee, _) = match self.infer.method_resolution(call_id) {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
};
|
||||
|
||||
if filter_map_next_checker
|
||||
.get_or_insert_with(|| {
|
||||
FilterMapNextChecker::new(&self.owner.resolver(db.upcast()), db)
|
||||
})
|
||||
.check(call_id, receiver, &callee)
|
||||
.is_some()
|
||||
{
|
||||
self.diagnostics.push(
|
||||
BodyValidationDiagnostic::ReplaceFilterMapNextWithFindMap {
|
||||
method_call_expr: call_id,
|
||||
},
|
||||
);
|
||||
}
|
||||
if filter_map_next_checker
|
||||
.get_or_insert_with(|| {
|
||||
FilterMapNextChecker::new(&self.owner.resolver(db.upcast()), db)
|
||||
})
|
||||
.check(call_id, receiver, &callee)
|
||||
.is_some()
|
||||
{
|
||||
self.diagnostics.push(BodyValidationDiagnostic::ReplaceFilterMapNextWithFindMap {
|
||||
method_call_expr: call_id,
|
||||
});
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue