fail -> panic

This commit is contained in:
Steve Klabnik 2014-10-29 21:59:06 -04:00
parent 041d14e8ea
commit 33c6edba07
9 changed files with 17 additions and 17 deletions

View File

@ -169,7 +169,7 @@ impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
}
fn unwrap(self) -> Box<Writer+'a> {
fail!("Can't unwrap a Shell");
panic!("Can't unwrap a Shell");
}
fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {

View File

@ -118,14 +118,14 @@ impl SourceId {
.with_precise(Some("locked".to_string()))
}
"path" => SourceId::for_path(&Path::new(url.slice_from(5))).unwrap(),
_ => fail!("Unsupported serialized SourceId")
_ => panic!("Unsupported serialized SourceId")
}
}
pub fn to_url(&self) -> String {
match *self.inner {
SourceIdInner { kind: PathKind, .. } => {
fail!("Path sources are not included in the lockfile, \
panic!("Path sources are not included in the lockfile, \
so this is unimplemented")
},
SourceIdInner {
@ -192,7 +192,7 @@ impl SourceId {
PathKind => {
let path = match self.inner.url.to_file_path() {
Ok(p) => p,
Err(()) => fail!("path sources cannot be remote"),
Err(()) => panic!("path sources cannot be remote"),
};
box PathSource::new(&path, self) as Box<Source>
},

View File

@ -30,7 +30,7 @@ impl<'a, 'b> GitSource<'a, 'b> {
let reference = match source_id.git_reference() {
Some(reference) => reference,
None => fail!("Not a git source; id={}", source_id),
None => panic!("Not a git source; id={}", source_id),
};
let remote = GitRemote::new(source_id.get_url());

View File

@ -109,7 +109,7 @@ mod imp {
macro_rules! call( ($e:expr) => ({
if $e == 0 {
fail!("failed {}: {}", stringify!($e), os::last_os_error())
panic!("failed {}: {}", stringify!($e), os::last_os_error())
}
}) )

View File

@ -144,7 +144,7 @@ impl ProjectBuilder {
// TODO: return something different than a ProjectBuilder
pub fn build(&self) -> &ProjectBuilder {
match self.build_with_result() {
Err(e) => fail!(e),
Err(e) => panic!(e),
_ => return self
}
}
@ -227,7 +227,7 @@ pub fn cargo_dir() -> Path {
os::getenv("CARGO_BIN_PATH").map(Path::new)
.or_else(|| os::self_exe_path())
.unwrap_or_else(|| {
fail!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test")
})
}
@ -327,7 +327,7 @@ impl Execs {
(None, Some(e)) => {
Some(format!("{:3} - |{}|\n +\n", i, e))
},
(None, None) => fail!("Cannot get here")
(None, None) => panic!("Cannot get here")
}
});
@ -450,7 +450,7 @@ impl<T,E: Show> ResultTest<T,E> for Result<T,E> {
fn assert(self) -> T {
match self {
Ok(val) => val,
Err(err) => fail!("Result was error: {}", err)
Err(err) => panic!("Result was error: {}", err)
}
}
}
@ -459,7 +459,7 @@ impl<T> ResultTest<T,()> for Option<T> {
fn assert(self) -> T {
match self {
Some(val) => val,
None => fail!("Option was None")
None => panic!("Option was None")
}
}
}

View File

@ -401,7 +401,7 @@ test!(dont_run_examples {
.file("src/lib.rs", r#"
"#)
.file("examples/dont-run-me-i-will-fail.rs", r#"
fn main() { fail!("Examples should not be run by 'cargo test'"); }
fn main() { panic!("Examples should not be run by 'cargo test'"); }
"#);
assert_that(p.cargo_process("bench"),
execs().with_status(0));

View File

@ -628,7 +628,7 @@ test!(custom_build_failure {
name = "foo"
"#)
.file("src/foo.rs", r#"
fn main() { fail!("nope") }
fn main() { panic!("nope") }
"#);
assert_that(build.cargo_process("build"), execs().with_status(0));
@ -691,7 +691,7 @@ test!(custom_second_build_failure {
name = "bar"
"#)
.file("src/bar.rs", r#"
fn main() { fail!("nope") }
fn main() { panic!("nope") }
"#);
assert_that(build2.cargo_process("build"), execs().with_status(0));

View File

@ -260,7 +260,7 @@ test!(release_works {
authors = []
"#)
.file("src/main.rs", r#"
fn main() { if !cfg!(ndebug) { fail!() } }
fn main() { if !cfg!(ndebug) { panic!() } }
"#);
assert_that(p.cargo_process("run").arg("--release"),

View File

@ -390,7 +390,7 @@ test!(dont_run_examples {
.file("src/lib.rs", r#"
"#)
.file("examples/dont-run-me-i-will-fail.rs", r#"
fn main() { fail!("Examples should not be run by 'cargo test'"); }
fn main() { panic!("Examples should not be run by 'cargo test'"); }
"#);
assert_that(p.cargo_process("test"),
execs().with_status(0));
@ -855,7 +855,7 @@ test!(test_no_run {
"#)
.file("src/lib.rs", "
#[test]
fn foo() { fail!() }
fn foo() { panic!() }
");
assert_that(p.cargo_process("test").arg("--no-run"),