-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rustup #2880
Rustup #2880
Conversation
clippy_lints/src/booleans.rs
Outdated
@@ -203,7 +203,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> { | |||
METHODS_WITH_NEGATION | |||
.iter().cloned() | |||
.flat_map(|(a, b)| vec![(a, b), (b, a)]) | |||
.find(|&(a, _)| a == path.name.as_str()) | |||
.find(|&(a, _)| a == path.ident.name.as_str()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ident.as_str()
works too (applicable to all something.ident.name.as_str()
here and below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I made note to myself to check that and forgot about it.
clippy_lints/src/let_if_seq.rs
Outdated
@@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { | |||
if let Some(expr) = it.peek(); | |||
if let hir::StmtDecl(ref decl, _) = stmt.node; | |||
if let hir::DeclLocal(ref decl) = decl.node; | |||
if let hir::PatKind::Binding(mode, canonical_id, ref name, None) = decl.pat.node; | |||
if let hir::PatKind::Binding(mode, canonical_id, ref ident, None) = decl.pat.node; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ident
is small and Copy
, so the ref
is not necessary (applicable to all PatKind::Binding
s).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there is clippy lint for it, nice catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the lint for that applies only on function arguments and not on matching. This could be a nice addition to that lint though!
clippy_lints/src/matches.rs
Outdated
@@ -270,7 +270,7 @@ fn check_single_match_opt_like(cx: &LateContext, ex: &Expr, arms: &[Arm], expr: | |||
} | |||
print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)) | |||
}, | |||
PatKind::Binding(BindingAnnotation::Unannotated, _, ident, None) => ident.node.to_string(), | |||
PatKind::Binding(BindingAnnotation::Unannotated, _, ident, None) => ident.name.to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ident.to_string()
works too.
Thank you @petrochenkov for reviewing this. I'll squash review commits (and more fixes is any) later. |
Squashed with minor fix for rust-lang/rust#50997 Update scripts don't work on Arch but I'll fix it. |
rust-lang/rust#51492 has made small changes to HIR.
I can bump version after new nightly is released.