about summary refs log tree commit diff
path: root/src/libcore/fmt
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-08-23 09:35:49 -0400
committerCorey Farwell <coreyf@rwell.org>2018-08-23 09:35:49 -0400
commit9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da (patch)
tree778cd550b1a9c85845d97483daefa82cc0226781 /src/libcore/fmt
parent917945d662c42053383fe3e71cb0f313d585e459 (diff)
downloadrust-9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da.tar.gz
rust-9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da.zip
Prefer `.nth(n)` over `.skip(n).next()`.
Found by clippy.
Diffstat (limited to 'src/libcore/fmt')
-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 928f95e3ba2..6ed90fdd4b6 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -1232,7 +1232,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