Drop the '2' suffix from logging macros

Who doesn't like a massive renaming?
This commit is contained in:
Alex Crichton 2013-10-21 13:08:31 -07:00
parent 15a6bdebab
commit daf5f5a4d1
726 changed files with 3060 additions and 3060 deletions

View file

@ -86,7 +86,7 @@ impl Clean<Crate> for visit_ast::RustdocVisitor {
Crate {
name: match maybe_meta {
Some(x) => x.to_owned(),
None => fail2!("rustdoc requires a \\#[link(name=\"foo\")] \
None => fail!("rustdoc requires a \\#[link(name=\"foo\")] \
crate attribute"),
},
module: Some(self.module.clean()),
@ -623,9 +623,9 @@ pub enum TypeKind {
impl Clean<Type> for ast::Ty {
fn clean(&self) -> Type {
use syntax::ast::*;
debug2!("cleaning type `{:?}`", self);
debug!("cleaning type `{:?}`", self);
let codemap = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap;
debug2!("span corresponds to `{}`", codemap.span_to_str(self.span));
debug!("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()),
@ -643,7 +643,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 => fail2!("Unimplemented type {:?}", x),
ref x => fail!("Unimplemented type {:?}", x),
}
}
}
@ -927,7 +927,7 @@ pub struct Static {
impl Clean<Item> for doctree::Static {
fn clean(&self) -> Item {
debug2!("claning static {}: {:?}", self.name.clean(), self);
debug!("claning static {}: {:?}", self.name.clean(), self);
Item {
name: Some(self.name.clean()),
attrs: self.attrs.clean(),
@ -1107,13 +1107,13 @@ trait ToSource {
impl ToSource for syntax::codemap::Span {
fn to_src(&self) -> ~str {
debug2!("converting span {:?} to snippet", self.clean());
debug!("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 => ~""
};
debug2!("got snippet {}", sn);
debug!("got snippet {}", sn);
sn
}
}
@ -1139,17 +1139,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(*) => fail2!("tried to get argument name from pat_struct, \
PatStruct(*) => fail!("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(*) => fail2!("tried to get argument name from pat_lit, \
PatLit(*) => fail!("tried to get argument name from pat_lit, \
which is not allowed in function arguments"),
PatRange(*) => fail2!("tried to get argument name from pat_range, \
PatRange(*) => fail!("tried to get argument name from pat_range, \
which is not allowed in function arguments"),
PatVec(*) => fail2!("tried to get argument name from pat_vec, \
PatVec(*) => fail!("tried to get argument name from pat_vec, \
which is not allowed in function arguments")
}
}
@ -1158,14 +1158,14 @@ fn name_from_pat(p: &ast::Pat) -> ~str {
fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
id: ast::NodeId) -> Type {
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
debug2!("searching for {:?} in defmap", id);
debug!("searching for {:?} in defmap", id);
let d = match cx.tycx.def_map.find(&id) {
Some(k) => k,
None => {
let ctxt = local_data::get(super::ctxtkey, |x| *x.unwrap());
debug2!("could not find {:?} in defmap (`{}`)", id,
debug!("could not find {:?} in defmap (`{}`)", id,
syntax::ast_map::node_id_to_str(ctxt.tycx.items, id, ctxt.sess.intr()));
fail2!("Unexpected failure: unresolved id not in defmap (this is a bug!)")
fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)")
}
};
@ -1174,7 +1174,7 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
ast::DefSelf(i) | ast::DefSelfTy(i) => return Self(i),
ast::DefTy(i) => (i, TypeEnum),
ast::DefTrait(i) => {
debug2!("saw DefTrait in def_to_id");
debug!("saw DefTrait in def_to_id");
(i, TypeTrait)
},
ast::DefPrimTy(p) => match p {
@ -1185,10 +1185,10 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
ast::DefTyParam(i, _) => return Generic(i.node),
ast::DefStruct(i) => (i, TypeStruct),
ast::DefTyParamBinder(i) => {
debug2!("found a typaram_binder, what is it? {}", i);
debug!("found a typaram_binder, what is it? {}", i);
return TyParamBinder(i);
},
x => fail2!("resolved type maps to a weird def {:?}", x),
x => fail!("resolved type maps to a weird def {:?}", x),
};
if ast_util::is_local(def_id) {
ResolvedPath{ path: path, typarams: tpbs, id: def_id.node }

View file

@ -84,7 +84,7 @@ fn get_ast_and_resolve(cpath: &Path,
.to_owned_vec());
}
debug2!("crate: {:?}", crate);
debug!("crate: {:?}", crate);
return (DocContext { crate: crate, tycx: ty_cx, sess: sess },
CrateAnalysis { reexports: reexports, exported_items: exported_items });
}
@ -92,9 +92,9 @@ fn get_ast_and_resolve(cpath: &Path,
pub fn run_core (libs: ~[Path], path: &Path) -> (clean::Crate, CrateAnalysis) {
let (ctxt, analysis) = get_ast_and_resolve(path, libs);
let ctxt = @ctxt;
debug2!("defmap:");
debug!("defmap:");
for (k, v) in ctxt.tycx.def_map.iter() {
debug2!("{:?}: {:?}", k, v);
debug!("{:?}: {:?}", k, v);
}
local_data::set(super::ctxtkey, ctxt);

View file

@ -291,7 +291,7 @@ pub fn run(mut crate: clean::Crate, dst: Path) {
// Render all source files (this may turn into a giant no-op)
{
info2!("emitting source files");
info!("emitting source files");
let dst = cx.dst.join("src");
mkdir(&dst);
let dst = dst.join(crate.name.as_slice());
@ -323,9 +323,9 @@ fn write(dst: Path, contents: &str) {
/// skipping if the directory already exists.
fn mkdir(path: &Path) {
do io::io_error::cond.trap(|err| {
error2!("Couldn't create directory `{}`: {}",
error!("Couldn't create directory `{}`: {}",
path.display(), err.desc);
fail2!()
fail!()
}).inside {
if !path.is_dir() {
file::mkdir(path);
@ -647,7 +647,7 @@ impl Context {
/// sure it always points to the top (relatively)
fn recurse<T>(&mut self, s: ~str, f: &fn(&mut Context) -> T) -> T {
if s.len() == 0 {
fail2!("what {:?}", self);
fail!("what {:?}", self);
}
let prev = self.dst.clone();
self.dst.push(s.as_slice());
@ -679,7 +679,7 @@ impl Context {
let workers = match os::getenv("RUSTDOC_WORKERS") {
Some(s) => {
match from_str::<uint>(s) {
Some(n) => n, None => fail2!("{} not a number", s)
Some(n) => n, None => fail!("{} not a number", s)
}
}
None => 10,
@ -974,7 +974,7 @@ fn document(w: &mut io::Writer, item: &clean::Item) {
fn item_module(w: &mut io::Writer, cx: &Context,
item: &clean::Item, items: &[clean::Item]) {
document(w, item);
debug2!("{:?}", items);
debug!("{:?}", items);
let mut indices = vec::from_fn(items.len(), |i| i);
fn lt(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> bool {
@ -1013,12 +1013,12 @@ fn item_module(w: &mut io::Writer, cx: &Context,
}
}
debug2!("{:?}", indices);
debug!("{:?}", indices);
do sort::quick_sort(indices) |&i1, &i2| {
lt(&items[i1], &items[i2], i1, i2)
}
debug2!("{:?}", indices);
debug!("{:?}", indices);
let mut curty = "";
for &idx in indices.iter() {
let myitem = &items[idx];

View file

@ -34,7 +34,7 @@ pub fn strip_hidden(crate: clean::Crate) -> plugins::PluginResult {
for innerattr in l.iter() {
match innerattr {
&clean::Word(ref s) if "hidden" == *s => {
debug2!("found one in strip_hidden; removing");
debug!("found one in strip_hidden; removing");
return None;
},
_ => (),

View file

@ -134,7 +134,7 @@ pub fn main_args(args: &[~str]) -> int {
}
};
info2!("going to format");
info!("going to format");
let started = time::precise_time_ns();
let output = matches.opt_str("o").map(|s| Path::new(s));
match matches.opt_str("w") {
@ -150,7 +150,7 @@ pub fn main_args(args: &[~str]) -> int {
}
}
let ended = time::precise_time_ns();
info2!("Took {:.03f}s", (ended as f64 - started as f64) / 1e9f64);
info!("Took {:.03f}s", (ended as f64 - started as f64) / 1e9f64);
return 0;
}
@ -192,12 +192,12 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
// First, parse the crate and extract all relevant information.
let libs = Cell::new(matches.opt_strs("L").map(|s| Path::new(s.as_slice())));
let cr = Cell::new(Path::new(cratefile));
info2!("starting to run rustc");
info!("starting to run rustc");
let (crate, analysis) = do std::task::try {
let cr = cr.take();
core::run_core(libs.take(), &cr)
}.unwrap();
info2!("finished with rustc");
info!("finished with rustc");
local_data::set(analysiskey, analysis);
// Process all of the crate attributes, extracting plugin metadata along
@ -238,19 +238,19 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {
Some(i) => PASSES[i].n1(),
None => {
error2!("unknown pass {}, skipping", *pass);
error!("unknown pass {}, skipping", *pass);
continue
},
};
pm.add_plugin(plugin);
}
info2!("loading plugins...");
info!("loading plugins...");
for pname in plugins.move_iter() {
pm.load_plugin(pname);
}
// Run everything!
info2!("Executing passes/plugins");
info!("Executing passes/plugins");
return pm.run_plugins(crate);
}
@ -311,7 +311,7 @@ fn json_output(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) {
};
let crate_json = match json::from_str(crate_json_str) {
Ok(j) => j,
Err(_) => fail2!("Rust generated JSON is invalid??")
Err(_) => fail!("Rust generated JSON is invalid??")
};
json.insert(~"crate", crate_json);

View file

@ -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 {
debug2!("Visiting struct");
debug!("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 {
debug2!("Visiting enum");
debug!("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 {
debug2!("Visiting fn");
debug!("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),
_ => fail2!("mod id mapped to non-item in the ast map")
_ => fail!("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) {
debug2!("Visiting item {:?}", item);
debug!("Visiting item {:?}", item);
match item.node {
ast::item_mod(ref m) => {
om.mods.push(visit_mod_contents(item.span, item.attrs.clone(),