Skip to content

Commit

Permalink
Rollup merge of rust-lang#42871 - llogiq:for_lowering_vs_clippy, r=ar…
Browse files Browse the repository at this point in the history
…ielb1

change binding name of for loop lowering to appease clippy

With the latest change to for loop lowering (rust-lang#42634), a `_next` binding was introduced.
Unfortunately, this [disturbs](https://github.com/Manishearth/rust-clippy/issues/1846) clippy's `used_underscore_binding` lint. This commit just renames the binding to `__next` so clippy will be happy. It should have no other effect.
  • Loading branch information
frewsxcv authored Jun 27, 2017
2 parents b2c3130 + ebe71fd commit b1afcb6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2170,12 +2170,12 @@ impl<'a> LoweringContext<'a> {
// let result = match ::std::iter::IntoIterator::into_iter(<head>) {
// mut iter => {
// [opt_ident]: loop {
// let mut _next;
// let mut __next;
// match ::std::iter::Iterator::next(&mut iter) {
// ::std::option::Option::Some(val) => _next = val,
// ::std::option::Option::Some(val) => __next = val,
// ::std::option::Option::None => break
// };
// let <pat> = _next;
// let <pat> = __next;
// StmtExpr(<body>);
// }
// }
Expand All @@ -2188,7 +2188,7 @@ impl<'a> LoweringContext<'a> {

let iter = self.str_to_ident("iter");

let next_ident = self.str_to_ident("_next");
let next_ident = self.str_to_ident("__next");
let next_pat = self.pat_ident_binding_mode(e.span,
next_ident,
hir::BindByValue(hir::MutMutable));
Expand Down Expand Up @@ -2237,13 +2237,13 @@ impl<'a> LoweringContext<'a> {

let next_expr = P(self.expr_ident(e.span, next_ident, next_pat.id));

// `let mut _next`
// `let mut __next`
let next_let = self.stmt_let_pat(e.span,
None,
next_pat,
hir::LocalSource::ForLoopDesugar);

// `let <pat> = _next`
// `let <pat> = __next`
let pat = self.lower_pat(pat);
let pat_let = self.stmt_let_pat(e.span,
Some(next_expr),
Expand Down

0 comments on commit b1afcb6

Please sign in to comment.