Skip to content

Conversation

@mati865
Copy link
Member

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

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

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
Member 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!

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
Member 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
Member 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