X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_save_analysis%2Fspan_utils.rs;h=f904a0bb9f8066857289be1eeeffd5bf9e049073;hb=88429fb5e250d61e60578e3ed5de4ac2d56567a8;hp=f2f512bc8e5ab0f378ea71ee446f812f789c05e0;hpb=dfd11229b3fa9959e99a7bbce7069a081274870b;p=rust.git diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index f2f512bc8e5..f904a0bb9f8 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -1,8 +1,8 @@ use crate::generated_code; use rustc::session::Session; use rustc_parse::lexer::{self, StringReader}; +use rustc_span::*; use syntax::token::{self, TokenKind}; -use syntax_pos::*; #[derive(Clone)] pub struct SpanUtils<'a> { @@ -11,29 +11,27 @@ pub struct SpanUtils<'a> { impl<'a> SpanUtils<'a> { pub fn new(sess: &'a Session) -> SpanUtils<'a> { - SpanUtils { - sess, - } + SpanUtils { sess } } pub fn make_filename_string(&self, file: &SourceFile) -> String { match &file.name { FileName::Real(path) if !file.name_was_remapped => { if path.is_absolute() { - self.sess.source_map().path_mapping() - .map_prefix(path.clone()).0 + self.sess + .source_map() + .path_mapping() + .map_prefix(path.clone()) + .0 .display() .to_string() } else { - self.sess.working_dir.0 - .join(&path) - .display() - .to_string() + self.sess.working_dir.0.join(&path).display().to_string() } - }, + } // If the file name is already remapped, we assume the user // configured it the way they wanted to, so use that directly - filename => filename.to_string() + filename => filename.to_string(), } } @@ -111,11 +109,7 @@ pub fn filter_generated(&self, span: Span) -> bool { } //If the span comes from a fake source_file, filter it. - !self.sess - .source_map() - .lookup_char_pos(span.lo()) - .file - .is_real_file() + !self.sess.source_map().lookup_char_pos(span.lo()).file.is_real_file() } }