Skip to content

Commit 6904761

Browse files
committed
Remove magic number
1 parent b206064 commit 6904761

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc_errors/emitter.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,8 @@ impl EmitterWriter {
737737
buffer.append(0, &level.to_string(), Style::HeaderMsg);
738738
buffer.append(0, ": ", Style::NoStyle);
739739

740-
// The extra 9 ` ` is the padding that's always needed to align to the `note: `.
741-
let message = self.msg_with_padding(msg, max_line_num_len + 9);
740+
// The extra 3 ` ` is the padding that's always needed to align to the `note: `.
741+
let message = self.msg_with_padding(msg, max_line_num_len + "note: ".len() + 3);
742742
buffer.append(0, &message, Style::NoStyle);
743743
} else {
744744
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
@@ -873,8 +873,8 @@ impl EmitterWriter {
873873
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
874874
buffer.append(0, ": ", Style::HeaderMsg);
875875

876-
// The extra 15 ` ` is the padding that's always needed to align to the `suggestion: `.
877-
let message = self.msg_with_padding(msg, max_line_num_len + 15);
876+
// The extra 3 ` ` is the padding that's always needed to align to the `suggestion: `.
877+
let message = self.msg_with_padding(msg, max_line_num_len + "suggestion: ".len() + 3);
878878
buffer.append(0, &message, Style::HeaderMsg);
879879

880880
let lines = cm.span_to_lines(primary_span).unwrap();

0 commit comments

Comments
 (0)