about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-08-24 16:44:50 +0800
committerkennytm <kennytm@gmail.com>2018-08-24 19:24:44 +0800
commit9dfb95b11fe61357e9f4ed9a8903a80cdaa06495 (patch)
tree4187187a00c250edac6695f58825386235f13fc0 /src/libcore
parenta37b69da9f3005da8b560f7422930559195a9ba3 (diff)
parent9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da (diff)
downloadrust-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.rs2
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