diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-09-27 23:22:34 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-30 23:21:19 -0700 |
| commit | a7f19f36be81cfc04d013fec80598193638fe55b (patch) | |
| tree | 9ab0a1baa32f74afcd091c85ce5548060ccb0ab3 | |
| parent | 4d47601a7e7324de1dd616a535248d908a1543fe (diff) | |
| download | rust-a7f19f36be81cfc04d013fec80598193638fe55b.tar.gz rust-a7f19f36be81cfc04d013fec80598193638fe55b.zip | |
rustdoc: Remove usage of fmt!
| -rw-r--r-- | src/librustdoc/clean.rs | 34 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/passes.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/rustdoc.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/visit_ast.rs | 10 |
6 files changed, 28 insertions, 28 deletions
diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index b4b086f3df0..b0f2ba286e6 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -71,7 +71,7 @@ impl Clean<Crate> for visit_ast::RustdocVisitor { Crate { name: match maybe_meta { Some(x) => x.to_owned(), - None => fail!("rustdoc_ng requires a #[link(name=\"foo\")] crate attribute"), + None => fail2!("rustdoc_ng requires a \\#[link(name=\"foo\")] crate attribute"), }, module: Some(self.module.clean()), } @@ -575,9 +575,9 @@ pub enum Type { impl Clean<Type> for ast::Ty { fn clean(&self) -> Type { use syntax::ast::*; - debug!("cleaning type `%?`", self); + debug2!("cleaning type `{:?}`", self); let codemap = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap; - debug!("span corresponds to `%s`", codemap.span_to_str(self.span)); + debug2!("span corresponds to `{}`", codemap.span_to_str(self.span)); match self.node { ty_nil => Unit, ty_ptr(ref m) => RawPointer(m.mutbl.clean(), ~m.ty.clean()), @@ -595,7 +595,7 @@ impl Clean<Type> for ast::Ty { ty_closure(ref c) => Closure(~c.clean()), ty_bare_fn(ref barefn) => BareFunction(~barefn.clean()), ty_bot => Bottom, - ref x => fail!("Unimplemented type %?", x), + ref x => fail2!("Unimplemented type {:?}", x), } } } @@ -873,7 +873,7 @@ pub struct Static { impl Clean<Item> for doctree::Static { fn clean(&self) -> Item { - debug!("claning static %s: %?", self.name.clean(), self); + debug2!("claning static {}: {:?}", self.name.clean(), self); Item { name: Some(self.name.clean()), attrs: self.attrs.clean(), @@ -1053,13 +1053,13 @@ trait ToSource { impl ToSource for syntax::codemap::Span { fn to_src(&self) -> ~str { - debug!("converting span %? to snippet", self.clean()); + debug2!("converting span {:?} to snippet", self.clean()); let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap.clone(); let sn = match cm.span_to_snippet(*self) { Some(x) => x, None => ~"" }; - debug!("got snippet %s", sn); + debug2!("got snippet {}", sn); sn } } @@ -1084,17 +1084,17 @@ fn name_from_pat(p: &ast::Pat) -> ~str { PatWild => ~"_", PatIdent(_, ref p, _) => path_to_str(p), PatEnum(ref p, _) => path_to_str(p), - PatStruct(*) => fail!("tried to get argument name from pat_struct, \ + PatStruct(*) => fail2!("tried to get argument name from pat_struct, \ which is not allowed in function arguments"), PatTup(*) => ~"(tuple arg NYI)", PatBox(p) => name_from_pat(p), PatUniq(p) => name_from_pat(p), PatRegion(p) => name_from_pat(p), - PatLit(*) => fail!("tried to get argument name from pat_lit, \ + PatLit(*) => fail2!("tried to get argument name from pat_lit, \ which is not allowed in function arguments"), - PatRange(*) => fail!("tried to get argument name from pat_range, \ + PatRange(*) => fail2!("tried to get argument name from pat_range, \ which is not allowed in function arguments"), - PatVec(*) => fail!("tried to get argument name from pat_vec, \ + PatVec(*) => fail2!("tried to get argument name from pat_vec, \ which is not allowed in function arguments") } } @@ -1117,14 +1117,14 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, use syntax::ast::*; let dm = local_data::get(super::ctxtkey, |x| *x.unwrap()).tycx.def_map; - debug!("searching for %? in defmap", id); + debug2!("searching for {:?} in defmap", id); let d = match dm.find(&id) { Some(k) => k, None => { let ctxt = local_data::get(super::ctxtkey, |x| *x.unwrap()); - debug!("could not find %? in defmap (`%s`)", id, + debug2!("could not find {:?} in defmap (`{}`)", id, syntax::ast_map::node_id_to_str(ctxt.tycx.items, id, ctxt.sess.intr())); - fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)") + fail2!("Unexpected failure: unresolved id not in defmap (this is a bug!)") } }; @@ -1133,7 +1133,7 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, DefSelf(i) | DefSelfTy(i) => return Self(i), DefTy(i) => i, DefTrait(i) => { - debug!("saw DefTrait in def_to_id"); + debug2!("saw DefTrait in def_to_id"); i }, DefPrimTy(p) => match p { @@ -1144,10 +1144,10 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>, DefTyParam(i, _) => return Generic(i.node), DefStruct(i) => i, DefTyParamBinder(i) => { - debug!("found a typaram_binder, what is it? %d", i); + debug2!("found a typaram_binder, what is it? {}", i); return TyParamBinder(i); }, - x => fail!("resolved type maps to a weird def %?", x), + x => fail2!("resolved type maps to a weird def {:?}", x), }; ResolvedPath{ path: path, typarams: tpbs, did: def_id } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index ff60241056c..7537366014e 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -62,15 +62,15 @@ fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext { crate = phase_2_configure_and_expand(sess, cfg, crate); let analysis = phase_3_run_analysis_passes(sess, &crate); - debug!("crate: %?", crate); + debug2!("crate: {:?}", crate); DocContext { crate: crate, tycx: analysis.ty_cx, sess: sess } } pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate { let ctxt = @get_ast_and_resolve(path, libs); - debug!("defmap:"); + debug2!("defmap:"); for (k, v) in ctxt.tycx.def_map.iter() { - debug!("%?: %?", k, v); + debug2!("{:?}: {:?}", k, v); } local_data::set(super::ctxtkey, ctxt); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 4702cb0f73d..441f25f33e6 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -205,7 +205,7 @@ fn mkdir(path: &Path) { do io::io_error::cond.trap(|err| { error2!("Couldn't create directory `{}`: {}", path.to_str(), err.desc); - fail!() + fail2!() }).inside { if !path.is_dir() { file::mkdir(path); diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index bbb20b31272..8f1955fb423 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -32,7 +32,7 @@ pub fn strip_hidden(crate: clean::Crate) -> plugins::PluginResult { for innerattr in l.iter() { match innerattr { &clean::Word(ref s) if "hidden" == *s => { - debug!("found one in strip_hidden; removing"); + debug2!("found one in strip_hidden; removing"); return None; }, _ => (), diff --git a/src/librustdoc/rustdoc.rs b/src/librustdoc/rustdoc.rs index 2405acd76b6..57aa62d313c 100644 --- a/src/librustdoc/rustdoc.rs +++ b/src/librustdoc/rustdoc.rs @@ -238,7 +238,7 @@ fn jsonify(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) { }; let crate_json = match extra::json::from_str(crate_json_str) { Ok(j) => j, - Err(_) => fail!("Rust generated JSON is invalid??") + Err(_) => fail2!("Rust generated JSON is invalid??") }; json.insert(~"crate", crate_json); diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 8e89c07ef00..9fd4c43c254 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -37,7 +37,7 @@ impl RustdocVisitor { self.attrs = crate.attrs.clone(); fn visit_struct_def(item: &ast::item, sd: @ast::struct_def, generics: &ast::Generics) -> Struct { - debug!("Visiting struct"); + debug2!("Visiting struct"); let struct_type = struct_type_from_def(sd); Struct { id: item.id, @@ -52,7 +52,7 @@ impl RustdocVisitor { } fn visit_enum_def(it: &ast::item, def: &ast::enum_def, params: &ast::Generics) -> Enum { - debug!("Visiting enum"); + debug2!("Visiting enum"); let mut vars: ~[Variant] = ~[]; for x in def.variants.iter() { vars.push(Variant { @@ -77,7 +77,7 @@ impl RustdocVisitor { fn visit_fn(item: &ast::item, fd: &ast::fn_decl, purity: &ast::purity, _abi: &AbiSet, gen: &ast::Generics) -> Function { - debug!("Visiting fn"); + debug2!("Visiting fn"); Function { id: item.id, vis: item.vis, @@ -96,7 +96,7 @@ impl RustdocVisitor { let name = match am.find(&id) { Some(m) => match m { &ast_map::node_item(ref it, _) => Some(it.ident), - _ => fail!("mod id mapped to non-item in the ast map") + _ => fail2!("mod id mapped to non-item in the ast map") }, None => None }; @@ -113,7 +113,7 @@ impl RustdocVisitor { } fn visit_item(item: &ast::item, om: &mut Module) { - debug!("Visiting item %?", item); + debug2!("Visiting item {:?}", item); match item.node { ast::item_mod(ref m) => { om.mods.push(visit_mod_contents(item.span, item.attrs.clone(), |
