mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
infinite_iter
: Only lock the symbol table once.
This commit is contained in:
parent
c73aceb043
commit
f493d71a38
1 changed files with 3 additions and 2 deletions
|
@ -226,13 +226,14 @@ const INFINITE_COLLECTORS: &[Symbol] = &[
|
|||
fn complete_infinite_iter(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
|
||||
match expr.kind {
|
||||
ExprKind::MethodCall(method, receiver, args, _) => {
|
||||
let method_str = method.ident.name.as_str();
|
||||
for &(name, len) in &COMPLETING_METHODS {
|
||||
if method.ident.name.as_str() == name && args.len() == len {
|
||||
if method_str == name && args.len() == len {
|
||||
return is_infinite(cx, receiver);
|
||||
}
|
||||
}
|
||||
for &(name, len) in &POSSIBLY_COMPLETING_METHODS {
|
||||
if method.ident.name.as_str() == name && args.len() == len {
|
||||
if method_str == name && args.len() == len {
|
||||
return MaybeInfinite.and(is_infinite(cx, receiver));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue