]> git.lizzy.rs Git - rust.git/commitdiff
Remove magic number
authorEsteban Küber <esteban@kuber.com.ar>
Mon, 9 Jan 2017 05:18:24 +0000 (21:18 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 9 Jan 2017 05:18:24 +0000 (21:18 -0800)
src/librustc_errors/emitter.rs

index dbef287f11337ff43ada1a52c62b4e4b236e2120..2640ff62d5b6dfe86c049ecd26874cbb678e7c42 100644 (file)
@@ -737,8 +737,8 @@ fn emit_message_default(&mut self,
             buffer.append(0, &level.to_string(), Style::HeaderMsg);
             buffer.append(0, ": ", Style::NoStyle);
 
-            // The extra 9 ` ` is the padding that's always needed to align to the `note: `.
-            let message = self.msg_with_padding(msg, max_line_num_len + 9);
+            // 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 + "note: ".len() + 3);
             buffer.append(0, &message, Style::NoStyle);
         } else {
             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, ": ", Style::HeaderMsg);
 
-            // The extra 15 ` ` is the padding that's always needed to align to the `suggestion: `.
-            let message = self.msg_with_padding(msg, max_line_num_len + 15);
+            // 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 + "suggestion: ".len() + 3);
             buffer.append(0, &message, Style::HeaderMsg);
 
             let lines = cm.span_to_lines(primary_span).unwrap();