diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-07 08:15:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-07 08:15:24 +0100 |
| commit | 5d1433b1f401d6b2a43a5728924c3725014b8cdc (patch) | |
| tree | 841a48dbf6e741b3877fec126aa4a2b6125ecb26 /src/librustc_parse/parser | |
| parent | 111724f5e2baa8b54612295352ba7b17a29b6059 (diff) | |
| parent | d3e5177f816d723cbce31ae7a7779feca8a69724 (diff) | |
| download | rust-5d1433b1f401d6b2a43a5728924c3725014b8cdc.tar.gz rust-5d1433b1f401d6b2a43a5728924c3725014b8cdc.zip | |
Rollup merge of #69656 - matthiaskrgr:iter_nth_zero, r=oli-obk
Use .next() instead of .nth(0) on iterators.
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/expr.rs | 2 | ||||
| -rw-r--r-- | src/librustc_parse/parser/pat.rs | 2 | ||||
| -rw-r--r-- | src/librustc_parse/parser/ty.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index e425ca6c4dd..505c6139ad6 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -1008,7 +1008,7 @@ impl<'a> Parser<'a> { }; let kind = if es.len() == 1 && !trailing_comma { // `(e)` is parenthesized `e`. - ExprKind::Paren(es.into_iter().nth(0).unwrap()) + ExprKind::Paren(es.into_iter().next().unwrap()) } else { // `(e,)` is a tuple with only one field, `e`. ExprKind::Tup(es) diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs index 45d1aacdd3c..4c041fd669d 100644 --- a/src/librustc_parse/parser/pat.rs +++ b/src/librustc_parse/parser/pat.rs @@ -479,7 +479,7 @@ impl<'a> Parser<'a> { // Here, `(pat,)` is a tuple pattern. // For backward compatibility, `(..)` is a tuple pattern as well. Ok(if fields.len() == 1 && !(trailing_comma || fields[0].is_rest()) { - PatKind::Paren(fields.into_iter().nth(0).unwrap()) + PatKind::Paren(fields.into_iter().next().unwrap()) } else { PatKind::Tuple(fields) }) diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index 3d2b0c014ac..c4469331b66 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -198,7 +198,7 @@ impl<'a> Parser<'a> { })?; if ts.len() == 1 && !trailing { - let ty = ts.into_iter().nth(0).unwrap().into_inner(); + let ty = ts.into_iter().next().unwrap().into_inner(); let maybe_bounds = allow_plus == AllowPlus::Yes && self.token.is_like_plus(); match ty.kind { // `(TY_BOUND_NOPAREN) + BOUND + ...`. |
