Skip to content
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

Merged
merged 3 commits into from
Jun 29, 2018
Merged

Rustup #2880

merged 3 commits into from
Jun 29, 2018

Conversation

mati865
Copy link
Contributor

@mati865 mati865 commented Jun 28, 2018

rust-lang/rust#51492 has made small changes to HIR.

I can bump version after new nightly is released.

@@ -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())
Copy link
Contributor

@petrochenkov petrochenkov Jun 28, 2018

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).

Copy link
Contributor Author

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.

@@ -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;
Copy link
Contributor

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::Bindings).

Copy link
Contributor Author

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.

Copy link
Member

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!

@@ -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(),
Copy link
Contributor

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.

@mati865
Copy link
Contributor Author

mati865 commented Jun 28, 2018

Thank you @petrochenkov for reviewing this.

I'll squash review commits (and more fixes is any) later.

@mati865
Copy link
Contributor Author

mati865 commented Jun 29, 2018

Squashed with minor fix for rust-lang/rust#50997

Update scripts don't work on Arch but I'll fix it.

@oli-obk oli-obk merged commit 3aee654 into rust-lang:master Jun 29, 2018
@mati865 mati865 deleted the rustup_hir branch June 29, 2018 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants