diff --git a/compiler/rustc_typeck/src/check/mod.rs b/compiler/rustc_typeck/src/check/mod.rs index d102896bfa613..8703949f4886a 100644 --- a/compiler/rustc_typeck/src/check/mod.rs +++ b/compiler/rustc_typeck/src/check/mod.rs @@ -849,7 +849,7 @@ fn missing_items_err( // Obtain the level of indentation ending in `sugg_sp`. let indentation = tcx.sess.source_map().span_to_margin(sugg_sp).unwrap_or(0); // Make the whitespace that will make the suggestion have the right indentation. - let padding: String = std::iter::repeat(" ").take(indentation).collect(); + let padding: String = " ".repeat(indentation); for trait_item in missing_items { let snippet = suggestion_signature(&trait_item, tcx); diff --git a/src/test/ui/issues/issue-20644.rs b/src/test/ui/issues/issue-20644.rs index 71c6746e0e040..1b90727fbc0a6 100644 --- a/src/test/ui/issues/issue-20644.rs +++ b/src/test/ui/issues/issue-20644.rs @@ -19,9 +19,7 @@ use std::path::Path; pub fn parse_summary(_: R, _: &Path) { let path_from_root = Path::new(""); - Path::new(&iter::repeat("../") - .take(path_from_root.components().count() - 1) - .collect::()); + Path::new(&"../".repeat(path_from_root.components().count() - 1)); } fn foo() {