diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index fca70fe8dbd..a3d1193052e 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -154,7 +154,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { if let LitKind::Str(ref lit_content, style) = lit.node { let callsite = snippet(cx, args[0].span.source_callsite(), r#""foo""#); let expanded = if let StrStyle::Raw(n) = style { - let term = (0..n).map(|_| '#').collect::(); + let term = "#".repeat(usize::from(n)); format!("r{0}\"{1}\"{0}", term, lit_content.as_str()) } else { format!("\"{}\"", lit_content.as_str())