diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-08-06 22:54:09 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-08-15 15:29:17 -0700 |
| commit | 1b6c9605e41b7c7dc23e0e6f633f05912d0463dd (patch) | |
| tree | 2482313e8e0761fd8e3ecddc8baad7bf96689b07 /src/librustc_errors | |
| parent | 82be83cf744611a016fb09ae1afbffc04b3ed2e1 (diff) | |
| download | rust-1b6c9605e41b7c7dc23e0e6f633f05912d0463dd.tar.gz rust-1b6c9605e41b7c7dc23e0e6f633f05912d0463dd.zip | |
use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/diagnostic.rs | 18 | ||||
| -rw-r--r-- | src/librustc_errors/diagnostic_builder.rs | 2 | ||||
| -rw-r--r-- | src/librustc_errors/emitter.rs | 8 | ||||
| -rw-r--r-- | src/librustc_errors/lib.rs | 8 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 91d32dbb84f..6c52eabd66d 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -83,9 +83,9 @@ impl Diagnostic { pub fn new_with_code(level: Level, code: Option<String>, message: &str) -> Self { Diagnostic { - level: level, + level, message: vec![(message.to_owned(), Style::NoStyle)], - code: code, + code, span: MultiSpan::new(), children: vec![], suggestions: vec![], @@ -306,10 +306,10 @@ impl Diagnostic { span: MultiSpan, render_span: Option<RenderSpan>) { let sub = SubDiagnostic { - level: level, + level, message: vec![(message.to_owned(), Style::NoStyle)], - span: span, - render_span: render_span, + span, + render_span, }; self.children.push(sub); } @@ -322,10 +322,10 @@ impl Diagnostic { span: MultiSpan, render_span: Option<RenderSpan>) { let sub = SubDiagnostic { - level: level, - message: message, - span: span, - render_span: render_span, + level, + message, + span, + render_span, }; self.children.push(sub); } diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 5d7c5e2829a..ee0bd949898 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -179,7 +179,7 @@ impl<'a> DiagnosticBuilder<'a> { message: &str) -> DiagnosticBuilder<'a> { DiagnosticBuilder { - handler: handler, + handler, diagnostic: Diagnostic::new_with_code(level, code, message) } } diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 3cfa635f5b2..22b6a888f25 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -120,7 +120,7 @@ impl EmitterWriter { if color_config.use_color() { let dst = Destination::from_stderr(); EmitterWriter { - dst: dst, + dst, cm: code_map, } } else { @@ -156,7 +156,7 @@ impl EmitterWriter { } // We don't have a line yet, create one slot.lines.push(Line { - line_index: line_index, + line_index, annotations: vec![ann], }); slot.lines.sort(); @@ -165,9 +165,9 @@ impl EmitterWriter { } // This is the first time we're seeing the file file_vec.push(FileWithAnnotatedLines { - file: file, + file, lines: vec![Line { - line_index: line_index, + line_index, annotations: vec![ann], }], multiline_depth: 0, diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 159d2c7a2df..3459771459a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -155,8 +155,8 @@ impl CodeSuggestion { let lo = primary_spans.iter().map(|sp| sp.0.lo).min().unwrap(); let hi = primary_spans.iter().map(|sp| sp.0.hi).min().unwrap(); let bounding_span = Span { - lo: lo, - hi: hi, + lo, + hi, ctxt: NO_EXPANSION, }; let lines = cm.span_to_lines(bounding_span).unwrap(); @@ -292,8 +292,8 @@ impl Handler { Handler { err_count: Cell::new(0), emitter: RefCell::new(e), - can_emit_warnings: can_emit_warnings, - treat_err_as_bug: treat_err_as_bug, + can_emit_warnings, + treat_err_as_bug, continue_after_error: Cell::new(true), delayed_span_bug: RefCell::new(None), } |
