Skip to content

Commit bfb80ad

Browse files
committed
Merge pull request #5 from jonathandturner/borrowck-snippet
Tidy fixes
2 parents 450786b + 5f9e151 commit bfb80ad

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

src/libsyntax/errors/emitter.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,17 @@ impl Emitter for EmitterWriter {
107107
}
108108

109109
fn emit_struct(&mut self, db: &DiagnosticBuilder) {
110-
self.emit_multispan(db.span.as_ref(), &db.message, db.code.as_ref().map(|s| &**s), db.level, true);
110+
self.emit_multispan(db.span.as_ref(), &db.message,
111+
db.code.as_ref().map(|s| &**s), db.level, true);
112+
111113
for child in &db.children {
112114
match child.render_span {
113115
Some(ref sp) =>
114-
self.emit_renderspan(sp, &child.message, child.level),
116+
self.emit_renderspan(sp, &child.message,
117+
child.level),
115118
None =>
116-
self.emit_multispan(child.span.as_ref(), &child.message, None, child.level, false),
119+
self.emit_multispan(child.span.as_ref(),
120+
&child.message, None, child.level, false),
117121
}
118122
}
119123
}
@@ -142,7 +146,8 @@ impl EmitterWriter {
142146
let dst = Destination::from_stderr();
143147
EmitterWriter { dst: dst, registry: registry, cm: code_map, first: true }
144148
} else {
145-
EmitterWriter { dst: Raw(Box::new(io::stderr())), registry: registry, cm: code_map, first: true }
149+
EmitterWriter { dst: Raw(Box::new(io::stderr())),
150+
registry: registry, cm: code_map, first: true }
146151
}
147152
}
148153

@@ -179,8 +184,8 @@ impl EmitterWriter {
179184
}
180185
}
181186

182-
fn emit_multispan(&mut self, span: Option<&MultiSpan>, msg: &str, code: Option<&str>, lvl: Level,
183-
is_header: bool) {
187+
fn emit_multispan(&mut self, span: Option<&MultiSpan>, msg: &str,
188+
code: Option<&str>, lvl: Level, is_header: bool) {
184189

185190
if is_header {
186191
self.emit_header(span);
@@ -209,13 +214,13 @@ impl EmitterWriter {
209214
rsp: &RenderSpan,
210215
msg: &str,
211216
code: Option<&str>,
212-
lvl: Level,
217+
lvl: Level,
213218
is_header: bool)
214219
-> io::Result<()> {
215220
let msp = rsp.span();
216221
let bounds = msp.primary_span();
217222

218-
let ss =
223+
let ss =
219224
if is_header {
220225
String::new()
221226
}
@@ -225,7 +230,7 @@ impl EmitterWriter {
225230

226231
match code {
227232
Some(code) if self.registry.as_ref()
228-
.and_then(|registry| registry.find_description(code)).is_some() =>
233+
.and_then(|registry| registry.find_description(code)).is_some() =>
229234
{
230235
let code_with_explain = String::from("--explain ") + code;
231236
print_diagnostic(&mut self.dst, &ss, lvl, msg, Some(&code_with_explain))?
@@ -363,10 +368,10 @@ fn line_num_max_digits(line: &codemap::LineInfo) -> usize {
363368
fn print_diagnostic(dst: &mut Destination,
364369
topic: &str,
365370
lvl: Level,
366-
msg: &str,
371+
msg: &str,
367372
code: Option<&str>)
368373
-> io::Result<()> {
369-
374+
370375
if !topic.is_empty() {
371376
dst.start_attr(term::Attr::ForegroundColor(lvl.color()))?;
372377
write!(dst, "{}: ", topic)?;

src/libsyntax/errors/snippet/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ impl SnippetData {
260260
line.text.insert(0, prefix);
261261
match line.kind {
262262
RenderedLineKind::Elision => {}
263-
_ => line.text.insert(1, StyledString {text: String::from("|> "), style: FileNameLine})
263+
_ => line.text.insert(1, StyledString {text: String::from("|> "),
264+
style: FileNameLine})
264265
}
265266
}
266267
}
@@ -582,7 +583,7 @@ impl RenderedLineKind {
582583
text: format!("{}", line_index + 1),
583584
style: FileNameLine,
584585
},
585-
Elision =>
586+
Elision =>
586587
StyledString {
587588
text: String::from("..."),
588589
style: FileNameLine,

src/libsyntax/ext/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
919919
ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(),
920920
self.ty_infer(span));
921921

922-
// TODO -- We are using `span` as the span of the `|...|`
922+
// FIXME -- We are using `span` as the span of the `|...|`
923923
// part of the lambda, but it probably (maybe?) corresponds to
924924
// the entire lambda body. Probably we should extend the API
925925
// here, but that's not entirely clear.

0 commit comments

Comments
 (0)