From 9e0ff24b6dbeaa549775ef77e5fdf8493f0f82da Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 23 Aug 2018 09:35:49 -0400 Subject: Prefer `.nth(n)` over `.skip(n).next()`. Found by clippy. --- src/libcore/fmt/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcore/fmt') 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 -- cgit 1.4.1-3-g733a5