mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 11:34:11 +00:00
Move pattern matching outside of the loop
This commit is contained in:
parent
60f3bd78ee
commit
0d33f6dfa9
@ -280,13 +280,15 @@ crate fn print_src(
|
|||||||
tmp /= 10;
|
tmp /= 10;
|
||||||
}
|
}
|
||||||
line_numbers.write_str("<pre class=\"line-numbers\">");
|
line_numbers.write_str("<pre class=\"line-numbers\">");
|
||||||
for i in 1..=lines {
|
match source_context {
|
||||||
match source_context {
|
SourceContext::Standalone => {
|
||||||
SourceContext::Standalone => {
|
for line in 1..=lines {
|
||||||
writeln!(line_numbers, "<span id=\"{0}\">{0:1$}</span>", i, cols)
|
writeln!(line_numbers, "<span id=\"{0}\">{0:1$}</span>", line, cols)
|
||||||
}
|
}
|
||||||
SourceContext::Embedded { offset } => {
|
}
|
||||||
writeln!(line_numbers, "<span>{0:1$}</span>", i + offset, cols)
|
SourceContext::Embedded { offset } => {
|
||||||
|
for line in 1..=lines {
|
||||||
|
writeln!(line_numbers, "<span>{0:1$}</span>", line + offset, cols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user