Remove magic number
This commit is contained in:
parent
b206064fc8
commit
690476191d
@ -737,8 +737,8 @@ fn emit_message_default(&mut self,
|
|||||||
buffer.append(0, &level.to_string(), Style::HeaderMsg);
|
buffer.append(0, &level.to_string(), Style::HeaderMsg);
|
||||||
buffer.append(0, ": ", Style::NoStyle);
|
buffer.append(0, ": ", Style::NoStyle);
|
||||||
|
|
||||||
// The extra 9 ` ` is the padding that's always needed to align to the `note: `.
|
// The extra 3 ` ` is the padding that's always needed to align to the `note: `.
|
||||||
let message = self.msg_with_padding(msg, max_line_num_len + 9);
|
let message = self.msg_with_padding(msg, max_line_num_len + "note: ".len() + 3);
|
||||||
buffer.append(0, &message, Style::NoStyle);
|
buffer.append(0, &message, Style::NoStyle);
|
||||||
} else {
|
} else {
|
||||||
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
|
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
|
||||||
@ -873,8 +873,8 @@ fn emit_suggestion_default(&mut self,
|
|||||||
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
|
buffer.append(0, &level.to_string(), Style::Level(level.clone()));
|
||||||
buffer.append(0, ": ", Style::HeaderMsg);
|
buffer.append(0, ": ", Style::HeaderMsg);
|
||||||
|
|
||||||
// The extra 15 ` ` is the padding that's always needed to align to the `suggestion: `.
|
// The extra 3 ` ` is the padding that's always needed to align to the `suggestion: `.
|
||||||
let message = self.msg_with_padding(msg, max_line_num_len + 15);
|
let message = self.msg_with_padding(msg, max_line_num_len + "suggestion: ".len() + 3);
|
||||||
buffer.append(0, &message, Style::HeaderMsg);
|
buffer.append(0, &message, Style::HeaderMsg);
|
||||||
|
|
||||||
let lines = cm.span_to_lines(primary_span).unwrap();
|
let lines = cm.span_to_lines(primary_span).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user