Skip to content

Commit 6138c82

Browse files
committed
fix tidy errors
1 parent a2ff845 commit 6138c82

File tree

10 files changed

+36
-19
lines changed

10 files changed

+36
-19
lines changed

src/libproc_macro/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl SourceFile {
432432
///
433433
/// ### Note
434434
/// If the code span associated with this `SourceFile` was generated by an external macro, this
435-
/// may not be an actual path on the filesystem. Use [`is_real`] to check.
435+
/// macro, this may not be an actual path on the filesystem. Use [`is_real`] to check.
436436
///
437437
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
438438
/// the command line, the path as given may not actually be valid.

src/librustc_errors/lib.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ pub mod registry;
5555
mod styled_buffer;
5656
mod lock;
5757

58-
use syntax_pos::{BytePos, Loc, FileLinesResult, SourceFile, FileName, MultiSpan, Span, NO_EXPANSION};
58+
use syntax_pos::{BytePos,
59+
Loc,
60+
FileLinesResult,
61+
SourceFile,
62+
FileName,
63+
MultiSpan,
64+
Span,
65+
NO_EXPANSION};
5966

6067
#[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
6168
pub enum Applicability {

src/librustc_lint/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
195195
let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS,
196196
fieldpat.span,
197197
&format!("the `{}:` in this pattern is redundant", ident));
198-
let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span, ':');
198+
let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span,
199+
':');
199200
err.span_suggestion_short_with_applicability(
200201
subspan,
201202
"remove this",

src/librustc_metadata/decoder.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for DecodeContext<'a, 'tcx> {
349349
debug_assert!(hi >= source_file.original_start_pos &&
350350
hi <= source_file.original_end_pos);
351351

352-
let lo = (lo + source_file.translated_source_file.start_pos) - source_file.original_start_pos;
353-
let hi = (hi + source_file.translated_source_file.start_pos) - source_file.original_start_pos;
352+
let lo = (lo + source_file.translated_source_file.start_pos)
353+
- source_file.original_start_pos;
354+
let hi = (hi + source_file.translated_source_file.start_pos)
355+
- source_file.original_start_pos;
354356

355357
Ok(Span::new(lo, hi, NO_EXPANSION))
356358
}

src/librustc_typeck/check/compare_method.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
319319
trait_m.ident);
320320
if let TypeError::Mutability = terr {
321321
if let Some(trait_err_span) = trait_err_span {
322-
if let Ok(trait_err_str) = tcx.sess.source_map().span_to_snippet(trait_err_span) {
322+
if let Ok(trait_err_str) = tcx.sess.source_map().
323+
span_to_snippet(trait_err_span) {
323324
diag.span_suggestion(
324325
impl_err_span,
325326
"consider change the type to match the mutability in trait",

src/librustc_typeck/check/method/suggest.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
132132
};
133133
if let Some(note_span) = note_span {
134134
// We have a span pointing to the method. Show note with snippet.
135-
err.span_note(self.tcx.sess.source_map().def_span(note_span), &note_str);
135+
err.span_note(self.tcx.sess.source_map().def_span(note_span),
136+
&note_str);
136137
} else {
137138
err.note(&note_str);
138139
}

src/librustdoc/html/highlight.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
3333
tooltip: Option<(&str, &str)>) -> String {
3434
debug!("highlighting: ================\n{}\n==============", src);
3535
let sess = parse::ParseSess::new(FilePathMapping::empty());
36-
let fm = sess.source_map().new_source_file(FileName::Custom("stdin".to_string()), src.to_string());
36+
let fm = sess.source_map().new_source_file(FileName::Custom("stdin".to_string()),
37+
src.to_string());
3738

3839
let mut out = Vec::new();
3940
if let Some((tooltip, class)) = tooltip {
@@ -43,7 +44,8 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
4344
}
4445
write_header(class, &mut out).unwrap();
4546

46-
let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None), sess.source_map());
47+
let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None),
48+
sess.source_map());
4749
if classifier.write_source(&mut out).is_err() {
4850
return format!("<pre>{}</pre>", src);
4951
}

src/libsyntax/parse/lexer/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ impl<'a> StringReader<'a> {
180180
}
181181

182182
/// For comments.rs, which hackily pokes into next_pos and ch
183-
fn new_raw(sess: &'a ParseSess, source_file: Lrc<syntax_pos::SourceFile>, override_span: Option<Span>)
184-
-> Self
185-
{
183+
fn new_raw(sess: &'a ParseSess,
184+
source_file: Lrc<syntax_pos::SourceFile>,
185+
override_span: Option<Span>) -> Self {
186186
let mut sr = StringReader::new_raw_internal(sess, source_file, override_span);
187187
sr.bump();
188188

@@ -221,9 +221,9 @@ impl<'a> StringReader<'a> {
221221
}
222222
}
223223

224-
pub fn new(sess: &'a ParseSess, source_file: Lrc<syntax_pos::SourceFile>, override_span: Option<Span>)
225-
-> Self
226-
{
224+
pub fn new(sess: &'a ParseSess,
225+
source_file: Lrc<syntax_pos::SourceFile>,
226+
override_span: Option<Span>) -> Self {
227227
let mut sr = StringReader::new_raw(sess, source_file, override_span);
228228
if sr.advance_token().is_err() {
229229
sr.emit_fatal_errors();

src/libsyntax/parse/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
240240
}
241241

242242
/// Given a source_file, produce a sequence of token-trees
243-
pub fn source_file_to_stream(sess: &ParseSess, source_file: Lrc<SourceFile>, override_span: Option<Span>)
244-
-> TokenStream {
243+
pub fn source_file_to_stream(sess: &ParseSess,
244+
source_file: Lrc<SourceFile>,
245+
override_span: Option<Span>) -> TokenStream {
245246
let mut srdr = lexer::StringReader::new(sess, source_file, override_span);
246247
srdr.real_token();
247248
panictry!(srdr.parse_all_token_trees())

src/libsyntax/source_map.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ impl SourceMap {
241241
let mut files = self.files.borrow_mut();
242242

243243
files.file_maps.push(source_file.clone());
244-
files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file), source_file.clone());
244+
files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
245+
source_file.clone());
245246

246247
source_file
247248
}
@@ -297,7 +298,8 @@ impl SourceMap {
297298
let mut files = self.files.borrow_mut();
298299

299300
files.file_maps.push(source_file.clone());
300-
files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file), source_file.clone());
301+
files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
302+
source_file.clone());
301303

302304
source_file
303305
}

0 commit comments

Comments
 (0)