From 322aedd462791e6e0b464b2430b76513c0360d8b Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Wed, 15 Oct 2014 03:20:39 -0400 Subject: [PATCH] librustdoc: Remove all uses of {:?}. --- src/librustdoc/clean/mod.rs | 16 ++++++++-------- src/librustdoc/core.rs | 2 +- src/librustdoc/doctree.rs | 1 + src/librustdoc/html/render.rs | 4 ++-- src/librustdoc/lib.rs | 4 ++-- src/librustdoc/visit_ast.rs | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7e9bb2844a7..102ba5820fe 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1251,7 +1251,7 @@ fn clean(&self, cx: &DocContext) -> Type { TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyParen(ref ty) => ty.clean(cx), TyBot => Bottom, - ref x => fail!("Unimplemented type {:?}", x), + ref x => fail!("Unimplemented type {}", x), } } } @@ -1575,7 +1575,7 @@ fn clean(&self, cx: &DocContext) -> VariantKind { } } -#[deriving(Clone, Encodable, Decodable)] +#[deriving(Clone, Encodable, Decodable, Show)] pub struct Span { pub filename: String, pub loline: uint, @@ -1714,7 +1714,7 @@ fn clean(&self, cx: &DocContext) -> BareFunctionDecl { } } -#[deriving(Clone, Encodable, Decodable)] +#[deriving(Clone, Encodable, Decodable, Show)] pub struct Static { pub type_: Type, pub mutability: Mutability, @@ -1726,7 +1726,7 @@ pub struct Static { impl Clean for doctree::Static { fn clean(&self, cx: &DocContext) -> Item { - debug!("claning static {}: {:?}", self.name.clean(cx), self); + debug!("claning static {}: {}", self.name.clean(cx), self); Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -2004,7 +2004,7 @@ trait ToSource { impl ToSource for syntax::codemap::Span { fn to_src(&self, cx: &DocContext) -> String { - debug!("converting span {:?} to snippet", self.clean(cx)); + debug!("converting span {} to snippet", self.clean(cx)); let sn = match cx.sess().codemap().span_to_snippet(*self) { Some(x) => x.to_string(), None => "".to_string() @@ -2017,7 +2017,7 @@ fn to_src(&self, cx: &DocContext) -> String { fn lit_to_string(lit: &ast::Lit) -> String { match lit.node { ast::LitStr(ref st, _) => st.get().to_string(), - ast::LitBinary(ref data) => format!("{:?}", data.as_slice()), + ast::LitBinary(ref data) => format!("{}", data), ast::LitByte(b) => { let mut res = String::from_str("b'"); (b as char).escape_default(|c| { @@ -2037,7 +2037,7 @@ fn lit_to_string(lit: &ast::Lit) -> String { fn name_from_pat(p: &ast::Pat) -> String { use syntax::ast::*; - debug!("Trying to get a name from pattern: {:?}", p); + debug!("Trying to get a name from pattern: {}", p); match p.node { PatWild(PatWildSingle) => "_".to_string(), @@ -2082,7 +2082,7 @@ fn resolve_type(cx: &DocContext, path: Path, // If we're extracting tests, this return value doesn't matter. None => return Primitive(Bool), }; - debug!("searching for {:?} in defmap", id); + debug!("searching for {} in defmap", id); let def = match tcx.def_map.borrow().find(&id) { Some(&k) => k, None => fail!("unresolved id not in defmap") diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index f0f08ff7077..c5c9aae89e4 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -135,7 +135,7 @@ pub fn run_core(libs: Vec, cfgs: Vec, externs: Externs, inlined: RefCell::new(Some(HashSet::new())), populated_crate_impls: RefCell::new(HashSet::new()), }; - debug!("crate: {:?}", ctxt.krate); + debug!("crate: {}", ctxt.krate); let analysis = CrateAnalysis { exported_items: exported_items, diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index b173f0f16e3..7509f96f916 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -141,6 +141,7 @@ pub struct Typedef { pub stab: Option, } +#[deriving(Show)] pub struct Static { pub type_: P, pub mutability: ast::Mutability, diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 497bbd3a1cd..b4bf1668d94 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1042,7 +1042,7 @@ impl Context { /// sure it always points to the top (relatively) fn recurse(&mut self, s: String, f: |&mut Context| -> T) -> T { if s.len() == 0 { - fail!("what {:?}", self); + fail!("Unexpected empty destination: {}", self.current); } let prev = self.dst.clone(); self.dst.push(s.as_slice()); @@ -1491,7 +1491,7 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering { indices.sort_by(|&i1, &i2| cmp(&items[i1], &items[i2], i1, i2)); - debug!("{:?}", indices); + debug!("{}", indices); let mut curty = None; for &idx in indices.iter() { let myitem = &items[idx]; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 44827a7b02c..ad79faebd45 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -333,7 +333,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche let (mut krate, analysis) = std::task::try(proc() { let cr = cr; core::run_core(libs, cfgs, externs, &cr, triple) - }).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap(); + }).map_err(|_| "rustc failed").unwrap(); info!("finished with rustc"); analysiskey.replace(Some(analysis)); @@ -480,7 +480,7 @@ fn json_output(krate: clean::Crate, res: Vec , }; let crate_json = match json::from_str(crate_json_str.as_slice()) { Ok(j) => j, - Err(e) => fail!("Rust generated JSON is invalid: {:?}", e) + Err(e) => fail!("Rust generated JSON is invalid: {}", e) }; json.insert("crate".to_string(), crate_json); diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 6456f4acd30..8e377037a97 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -264,7 +264,7 @@ fn resolve_id(&mut self, id: ast::NodeId, renamed: Option, pub fn visit_item(&mut self, item: &ast::Item, renamed: Option, om: &mut Module) { - debug!("Visiting item {:?}", item); + debug!("Visiting item {}", item); let name = renamed.unwrap_or(item.ident); match item.node { ast::ItemMod(ref m) => { -- GitLab