diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index ba70ed8622a0b..962a954ff74ad 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -280,13 +280,15 @@ crate fn print_src( tmp /= 10; } line_numbers.write_str("
"); - for i in 1..=lines { - match source_context { - SourceContext::Standalone => { - writeln!(line_numbers, "{0:1$}", i, cols) + match source_context { + SourceContext::Standalone => { + for line in 1..=lines { + writeln!(line_numbers, "{0:1$}", line, cols) } - SourceContext::Embedded { offset } => { - writeln!(line_numbers, "{0:1$}", i + offset, cols) + } + SourceContext::Embedded { offset } => { + for line in 1..=lines { + writeln!(line_numbers, "{0:1$}", line + offset, cols) } } }