Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
save-analysis: don't include the crate name in fully qualified paths
  • Loading branch information
nrc committed Jan 29, 2015
1 parent 265a233 commit 127c253
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
6 changes: 2 additions & 4 deletions src/librustc_trans/save/mod.rs
Expand Up @@ -44,7 +44,7 @@ use syntax::codemap::*;
use syntax::parse::token::{self, get_ident, keywords};
use syntax::owned_slice::OwnedSlice;
use syntax::visit::{self, Visitor};
use syntax::print::pprust::{path_to_string,ty_to_string};
use syntax::print::pprust::{path_to_string, ty_to_string};
use syntax::ptr::P;

use self::span_utils::SpanUtils;
Expand Down Expand Up @@ -123,7 +123,6 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {

let mut result: Vec<(Span, String)> = vec!();


let mut segs = vec!();
for (seg, span) in path.segments.iter().zip(spans.iter()) {
segs.push(seg.clone());
Expand Down Expand Up @@ -1568,8 +1567,7 @@ pub fn process_crate(sess: &Session,
SpanUtils {
sess: sess,
err_count: Cell::new(0)
},
cratename.clone()),
}),
span: SpanUtils {
sess: sess,
err_count: Cell::new(0)
Expand Down
15 changes: 2 additions & 13 deletions src/librustc_trans/save/recorder.rs
Expand Up @@ -50,7 +50,6 @@ impl Recorder {
pub struct FmtStrs<'a> {
pub recorder: Box<Recorder>,
span: SpanUtils<'a>,
krate: String,
}

macro_rules! s { ($e:expr) => { format!("{}", $e) }}
Expand Down Expand Up @@ -92,11 +91,10 @@ pub enum Row {
}

impl<'a> FmtStrs<'a> {
pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> {
pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>) -> FmtStrs<'a> {
FmtStrs {
recorder: rec,
span: span,
krate: krate,
}
}

Expand Down Expand Up @@ -177,16 +175,7 @@ impl<'a> FmtStrs<'a> {
});

let pairs = fields.iter().zip(values);
let strs = pairs.map(|(f, v)| format!(",{},\"{}\"", f, escape(
if *f == "qualname" && v.len() > 0 {
let mut n = self.krate.clone();
n.push_str("::");
n.push_str(v);
n
} else {
String::from_str(v)
}
)));
let strs = pairs.map(|(f, v)| format!(",{},\"{}\"", f, escape(String::from_str(v))));
Some(strs.fold(String::new(), |mut s, ss| {
s.push_str(&ss[]);
s
Expand Down

0 comments on commit 127c253

Please sign in to comment.