Skip to content

Commit c287d86

Browse files
committed
Use .nth(x) instead of .skip(x).next() on iterators.
1 parent 5abaeb3 commit c287d86

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/librustc_codegen_ssa/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub fn get_linker(sess: &Session, linker: &Path, flavor: LinkerFlavor) -> (PathB
186186
if flavor == LinkerFlavor::Msvc && t.target_vendor == "uwp" {
187187
if let Some(ref tool) = msvc_tool {
188188
let original_path = tool.path();
189-
if let Some(ref root_lib_path) = original_path.ancestors().skip(4).next() {
189+
if let Some(ref root_lib_path) = original_path.ancestors().nth(4) {
190190
let arch = match t.arch.as_str() {
191191
"x86_64" => Some("x64".to_string()),
192192
"x86" => Some("x86".to_string()),

src/librustc_infer/traits/error_reporting/suggestions.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
401401
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
402402
let refs_number =
403403
snippet.chars().filter(|c| !c.is_whitespace()).take_while(|c| *c == '&').count();
404-
if let Some('\'') =
405-
snippet.chars().filter(|c| !c.is_whitespace()).skip(refs_number).next()
406-
{
404+
if let Some('\'') = snippet.chars().filter(|c| !c.is_whitespace()).nth(refs_number) {
407405
// Do not suggest removal of borrow from type arguments.
408406
return;
409407
}
@@ -464,9 +462,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
464462
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
465463
let refs_number =
466464
snippet.chars().filter(|c| !c.is_whitespace()).take_while(|c| *c == '&').count();
467-
if let Some('\'') =
468-
snippet.chars().filter(|c| !c.is_whitespace()).skip(refs_number).next()
469-
{
465+
if let Some('\'') = snippet.chars().filter(|c| !c.is_whitespace()).nth(refs_number) {
470466
// Do not suggest removal of borrow from type arguments.
471467
return;
472468
}

0 commit comments

Comments
 (0)