Skip to content

Commit

Permalink
fail! -> panic!
Browse files Browse the repository at this point in the history
  • Loading branch information
cadencemarseille committed May 16, 2015
1 parent 83e7063 commit 215f62c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/pcre/detail/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014 The rust-pcre authors.
// Copyright 2015 The rust-pcre authors.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand Down Expand Up @@ -72,7 +72,7 @@ pub unsafe fn pcre_exec(code: *const pcre, extra: *const ::PcreExtra, subject: *
if rc == PCRE_ERROR_NOMATCH {
return -1;
} else if rc < 0 && rc != PCRE_ERROR_NULL {
fail!("pcre_exec");
panic!("pcre_exec");
}

rc
Expand All @@ -90,17 +90,17 @@ pub unsafe fn pcre_fullinfo(code: *const pcre, extra: *const ::PcreExtra, what:
assert!(code.is_not_null());
let rc = native::pcre_fullinfo(code, extra, what, where_);
if rc < 0 && rc != PCRE_ERROR_NULL {
fail!("pcre_fullinfo");
panic!("pcre_fullinfo");
}
}

pub unsafe fn pcre_refcount(code: *mut ::detail::pcre, adjust: c_int) -> c_int {
assert!(code.is_not_null());
let curr_refcount = native::pcre_refcount(code, 0);
if curr_refcount + adjust < 0 {
fail!("refcount underflow");
panic!("refcount underflow");
} else if curr_refcount + adjust > 65535 {
fail!("refcount overflow");
panic!("refcount overflow");
}
native::pcre_refcount(code, adjust)
}
Expand All @@ -121,7 +121,7 @@ pub unsafe fn pcre_study(code: *const ::detail::pcre, options: &EnumSet<::StudyO
None => error!("pcre_study() failed"),
Some(err_str) => error!("pcre_study() failed: {}", err_str)
}
fail!("pcre_study");
panic!("pcre_study");
}
assert!(err.is_null());

Expand Down
10 changes: 5 additions & 5 deletions src/pcre/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014 The rust-pcre authors.
// Copyright 2015 The rust-pcre authors.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
Expand Down Expand Up @@ -192,7 +192,7 @@ impl CLike for CompileOption {
19u => BsrUnicode,
20u => JavaScriptCompat,
21u => Ucp,
_ => fail!("unknown CompileOption number {:u}", n)
_ => panic!("unknown CompileOption number {}", n)
}
}

Expand Down Expand Up @@ -241,7 +241,7 @@ impl CLike for ExecOption {
13u => ExecNoStartOptimise,
14u => ExecPartialHard,
15u => ExecNotEmptyAtStart,
_ => fail!("unknown ExecOption number {:u}", n)
_ => panic!("unknown ExecOption number {}", n)
}
}

Expand Down Expand Up @@ -276,7 +276,7 @@ impl CLike for ExtraOption {
5u => ExtraMatchLimitRecursion,
6u => ExtraMark,
7u => ExtraExecutableJit,
_ => fail!("unknown ExtraOption number {:u}", n)
_ => panic!("unknown ExtraOption number {}", n)
}
}

Expand All @@ -300,7 +300,7 @@ impl CLike for StudyOption {
2u => StudyJitPartialSoftCompile,
3u => StudyJitPartialHardCompile,
4u => StudyExtraNeeded,
_ => fail!("unknown StudyOption number {:u}", n)
_ => panic!("unknown StudyOption number {}", n)
}
}

Expand Down

0 comments on commit 215f62c

Please sign in to comment.