diff options
| author | kennytm <kennytm@gmail.com> | 2018-08-24 16:44:50 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-08-24 19:24:44 +0800 |
| commit | 9dfb95b11fe61357e9f4ed9a8903a80cdaa06495 (patch) | |
| tree | 4187187a00c250edac6695f58825386235f13fc0 /src/libcore | |
| parent | a37b69da9f3005da8b560f7422930559195a9ba3 (diff) | |
| parent | 9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da (diff) | |
| download | rust-9dfb95b11fe61357e9f4ed9a8903a80cdaa06495.tar.gz rust-9dfb95b11fe61357e9f4ed9a8903a80cdaa06495.zip | |
Rollup merge of #53636 - frewsxcv:frewsxcv-nth, r=rkruppe
Prefer `.nth(n)` over `.skip(n).next()`. Found by clippy.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 6493f5b39a7..7d131b5c99d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1262,7 +1262,7 @@ impl<'a> Formatter<'a> { // If our string is longer that the precision, then we must have // truncation. However other flags like `fill`, `width` and `align` // must act as always. - if let Some((i, _)) = s.char_indices().skip(max).next() { + if let Some((i, _)) = s.char_indices().nth(max) { // LLVM here can't prove that `..i` won't panic `&s[..i]`, but // we know that it can't panic. Use `get` + `unwrap_or` to avoid // `unsafe` and otherwise don't emit any panic-related code |
