Skip to content

Diff of own seperate fail!(fmt!(...)) -> fail!(...) and fail!(~"...") -> fail!("...") cleanup #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/libcore/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,9 @@ pub fn to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Copy+
num: &T, radix: uint, negative_zero: bool,
sign: SignFormat, digits: SignificantDigits) -> (~[u8], bool) {
if (radix as int) < 2 {
fail!("to_str_bytes_common: radix %? to low, \
must lie in the range [2, 36]", radix);
fail!("to_str_bytes_common: radix %? to low, must lie in the range [2, 36]", radix);
} else if radix as int > 36 {
fail!("to_str_bytes_common: radix %? to high, \
must lie in the range [2, 36]", radix);
fail!("to_str_bytes_common: radix %? to high, must lie in the range [2, 36]", radix);
}

let _0: T = Zero::zero();
Expand Down Expand Up @@ -442,19 +440,19 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Copy+Div<T,T>+
match exponent {
ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e'
=> fail!("from_str_bytes_common: radix %? incompatible with \
use of 'e' as decimal exponent", radix),
use of 'e' as decimal exponent", radix),
ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p'
=> fail!("from_str_bytes_common: radix %? incompatible with \
use of 'p' as binary exponent", radix),
use of 'p' as binary exponent", radix),
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
=> fail!("from_str_bytes_common: radix %? incompatible with \
special values 'inf' and 'NaN'", radix),
special values 'inf' and 'NaN'", radix),
_ if (radix as int) < 2
=> fail!("from_str_bytes_common: radix %? to low, \
must lie in the range [2, 36]", radix),
must lie in the range [2, 36]", radix),
_ if (radix as int) > 36
=> fail!("from_str_bytes_common: radix %? to high, \
must lie in the range [2, 36]", radix),
must lie in the range [2, 36]", radix),
_ => ()
}

Expand Down
6 changes: 2 additions & 4 deletions src/libcore/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ pub fn env() -> ~[(~str,~str)] {
};
let ch = GetEnvironmentStringsA();
if (ch as uint == 0) {
fail!("os::env() failure getting env string from OS: %s",
os::last_os_error());
fail!("os::env() failure getting env string from OS: %s", os::last_os_error());
}
let mut curr_ptr: uint = ch as uint;
let mut result = ~[];
Expand All @@ -202,8 +201,7 @@ pub fn env() -> ~[(~str,~str)] {
}
let environ = rustrt::rust_env_pairs();
if (environ as uint == 0) {
fail!("os::env() failure getting env string from OS: %s",
os::last_os_error());
fail!("os::env() failure getting env string from OS: %s", os::last_os_error());
}
let mut result = ~[];
ptr::array_each(environ, |e| {
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,7 @@ pub fn program_output(prog: &str, args: &[~str]) -> ProgramOutput {
errs = s;
}
(n, _) => {
fail!("program_output received an unexpected file \
number: %u", n);
fail!("program_output received an unexpected file number: %u", n);
}
};
count -= 1;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ pub fn each_split_within<'a>(ss: &'a str,
(B, Cr, UnderLim) => { B }
(B, Cr, OverLim) if (i - last_start + 1) > lim
=> fail!("word starting with %? longer than limit!",
self::slice(ss, last_start, i + 1)),
self::slice(ss, last_start, i + 1)),
(B, Cr, OverLim) => { slice(); slice_start = last_start; B }
(B, Ws, UnderLim) => { last_end = i; C }
(B, Ws, OverLim) => { last_end = i; slice(); A }
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/task/local_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ fn test_tls_modify() {
local_data_modify(my_key, |data| {
match data {
Some(@ref val) => fail!("unwelcome value: %s", *val),
None => Some(@~"first data")
None => Some(@~"first data")
}
});
local_data_modify(my_key, |data| {
match data {
Some(@~"first data") => Some(@~"next data"),
Some(@ref val) => fail!("wrong value: %s", *val),
Some(@ref val) => fail!("wrong value: %s", *val),
None => fail!("missing value")
}
});
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,7 @@ mod test {
let matches =
&match getopts(~[~"--test"], optgroups()) {
Ok(copy m) => m,
Err(copy f) => fail!("test_switch_implies_cfg_test: %s",
getopts::fail_str(f))
Err(copy f) => fail!("test_switch_implies_cfg_test: %s", getopts::fail_str(f))
};
let sessopts = build_session_options(
@~"rustc", matches, diagnostic::emit);
Expand All @@ -935,8 +934,7 @@ mod test {
&match getopts(~[~"--test", ~"--cfg=test"], optgroups()) {
Ok(copy m) => m,
Err(copy f) => {
fail!("test_switch_implies_cfg_test_unless_cfg_test: %s",
getopts::fail_str(f));
fail!("test_switch_implies_cfg_test_unless_cfg_test: %s", getopts::fail_str(f));
}
};
let sessopts = build_session_options(
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,13 @@ pub fn parse_def_id(buf: &[u8]) -> ast::def_id {

let crate_num = match uint::parse_bytes(crate_part, 10u) {
Some(cn) => cn as int,
None => fail!("internal error: parse_def_id: crate number \
expected, but found %?", crate_part)
None => fail!("internal error: parse_def_id: crate number expected, but found %?",
crate_part)
};
let def_num = match uint::parse_bytes(def_part, 10u) {
Some(dn) => dn as int,
None => fail!("internal error: parse_def_id: id expected, but \
found %?", def_part)
None => fail!("internal error: parse_def_id: id expected, but found %?",
def_part)
};
ast::def_id { crate: crate_num, node: def_num }
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
if ts.len() != type_param_defs.len() {
// Fail earlier to make debugging easier
fail!("internal error: in kind::check_expr, length \
mismatch between actual and declared bounds: actual = \
%s, declared = %s",
ts.repr(cx.tcx),
type_param_defs.repr(cx.tcx));
mismatch between actual and declared bounds: actual = \
%s, declared = %s",
ts.repr(cx.tcx),
type_param_defs.repr(cx.tcx));
}
for vec::each2(**ts, *type_param_defs) |&ty, type_param_def| {
check_bounds(cx, type_parameter_id, e.span, ty, type_param_def)
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/typeck/infer/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ pub impl Env {
fn assert_subtype(&self, a: ty::t, b: ty::t) {
if !self.is_subtype(a, b) {
fail!("%s is not a subtype of %s, but it should be",
self.ty_to_str(a),
self.ty_to_str(b));
self.ty_to_str(a),
self.ty_to_str(b));
}
}

fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
if self.is_subtype(a, b) {
fail!("%s is a subtype of %s, but it shouldn't be",
self.ty_to_str(a),
self.ty_to_str(b));
self.ty_to_str(a),
self.ty_to_str(b));
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/librustdoc/attr_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ fn fold_enum(
copy ast_variant.node.attrs)
}
_ => {
fail!("Enum variant %s has id that's \
not bound to an enum item",
variant.name)
fail!("Enum variant %s has id that's not bound to an enum item",
variant.name)
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustpkg/rustpkg.rc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ impl PkgScript {
}
}
Err(e) => {
fail!("Running package script, couldn't find rustpkg sysroot (%s)",
e)
fail!("Running package script, couldn't find rustpkg sysroot (%s)", e)
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/librustpkg/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ pub fn pkg_parent_workspaces(pkgid: PkgId, action: &fn(&Path) -> bool) {
workspace_contains_package_id(pkgid, ws));
if workspaces.is_empty() {
// tjc: make this a condition
fail!("Package %s not found in any of \
the following workspaces: %s",
pkgid.path.to_str(),
rust_path().to_str());
fail!("Package %s not found in any of the following workspaces: %s",
pkgid.path.to_str(),
rust_path().to_str());
}
for workspaces.each |ws| {
if action(ws) {
Expand Down
11 changes: 4 additions & 7 deletions src/libstd/ebml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ pub mod reader {
self.pos = r_doc.end;
let str = doc_as_str(r_doc);
if lbl != str {
fail!("Expected label %s but found %s",
lbl,
str);
fail!("Expected label %s but found %s", lbl, str);
}
}
}
Expand All @@ -304,12 +302,11 @@ pub mod reader {
copy self.parent.start, copy self.parent.end,
copy self.pos, r_tag, r_doc.start, r_doc.end);
if r_tag != (exp_tag as uint) {
fail!("expected EBML doc with tag %? but found tag %?",
exp_tag, r_tag);
fail!("expected EBML doc with tag %? but found tag %?", exp_tag, r_tag);
}
if r_doc.end > self.parent.end {
fail!("invalid EBML, child extends to 0x%x, \
parent to 0x%x", r_doc.end, self.parent.end);
fail!("invalid EBML, child extends to 0x%x, parent to 0x%x",
r_doc.end, self.parent.end);
}
self.pos = r_doc.end;
r_doc
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/net_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@ mod test {
assert!(true);
}
_ => {
fail!("expected address_in_use listen error,\
fail!("expected address_in_use listen error, \
but got a different error varient. check logs.");
}
}
Expand All @@ -1713,7 +1713,7 @@ mod test {
assert!(true);
}
_ => {
fail!("expected address_in_use listen error,\
fail!("expected address_in_use listen error, \
but got a different error varient. check logs.");
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/libstd/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,9 @@ fn check_cvar_bounds<U>(out_of_bounds: Option<uint>, id: uint, act: &str,
blk: &fn() -> U) -> U {
match out_of_bounds {
Some(0) =>
fail!("%s with illegal ID %u - this lock has no condvars!",
act, id),
fail!("%s with illegal ID %u - this lock has no condvars!", act, id),
Some(length) =>
fail!("%s with illegal ID %u - ID must be less than %u",
act, id, length),
fail!("%s with illegal ID %u - ID must be less than %u", act, id, length),
None => blk()
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/libsyntax/codemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ priv impl CodeMap {
}
}
if (a >= len) {
fail!("position %u does not resolve to a source location",
pos.to_uint())
fail!("position %u does not resolve to a source location", pos.to_uint())
}

return a;
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ pub fn core_macros() -> ~str {
let expected_val = $expected;
// check both directions of equality....
if !((given_val == expected_val) && (expected_val == given_val)) {
fail!(\"left: %? != right: %?\", given_val, expected_val);
fail!(\"left: %? does not equal right: %?\", given_val, expected_val);
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2242,7 +2242,7 @@ mod test {

fn string_check<T:Eq> (given : &T, expected: &T) {
if !(given == expected) {
fail!("given %?, expected %?",given,expected);
fail!("given %?, expected %?", given, expected);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/while-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

// error-pattern:giraffe
fn main() {
fail!({ while true { fail!(~"giraffe")}; "clandestine" });
fail!({ while true { fail!("giraffe") }; "clandestine" });
}
2 changes: 1 addition & 1 deletion src/test/run-pass/nullable-pointer-iotareduction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ macro_rules! check_fancy {
match t_.get_ref() {
(23, $v) => { $chk }
_ => fail!("Thing::<%s>(23, %s).get_ref() != (23, _)",
stringify!($T), stringify!($e))
stringify!($T), stringify!($e))
}
}}
}
Expand Down