diff options
Diffstat (limited to 'src/libregex')
| -rw-r--r-- | src/libregex/compile.rs | 8 | ||||
| -rw-r--r-- | src/libregex/lib.rs | 2 | ||||
| -rw-r--r-- | src/libregex/parse.rs | 14 | ||||
| -rw-r--r-- | src/libregex/re.rs | 2 | ||||
| -rw-r--r-- | src/libregex/test/bench.rs | 4 | ||||
| -rw-r--r-- | src/libregex/test/mod.rs | 2 | ||||
| -rw-r--r-- | src/libregex/test/tests.rs | 4 |
7 files changed, 18 insertions, 18 deletions
diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index a32dfcf5d2a..53d2ea62a2a 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -240,13 +240,13 @@ impl<'r> Compiler<'r> { /// Sets the left and right locations of a `Split` instruction at index /// `i` to `pc1` and `pc2`, respectively. /// If the instruction at index `i` isn't a `Split` instruction, then - /// `fail!` is called. + /// `panic!` is called. #[inline] fn set_split(&mut self, i: InstIdx, pc1: InstIdx, pc2: InstIdx) { let split = self.insts.get_mut(i); match *split { Split(_, _) => *split = Split(pc1, pc2), - _ => fail!("BUG: Invalid split index."), + _ => panic!("BUG: Invalid split index."), } } @@ -260,13 +260,13 @@ impl<'r> Compiler<'r> { /// Sets the location of a `Jump` instruction at index `i` to `pc`. /// If the instruction at index `i` isn't a `Jump` instruction, then - /// `fail!` is called. + /// `panic!` is called. #[inline] fn set_jump(&mut self, i: InstIdx, pc: InstIdx) { let jmp = self.insts.get_mut(i); match *jmp { Jump(_) => *jmp = Jump(pc), - _ => fail!("BUG: Invalid jump index."), + _ => panic!("BUG: Invalid jump index."), } } } diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index bb6df26dab4..691dd2a3a6c 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -31,7 +31,7 @@ //! use regex::Regex; //! let re = match Regex::new(r"^\d{4}-\d{2}-\d{2}$") { //! Ok(re) => re, -//! Err(err) => fail!("{}", err), +//! Err(err) => panic!("{}", err), //! }; //! assert_eq!(re.is_match("2014-01-01"), true); //! ``` diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index 1d1d1a0e9c5..e62fc3602c2 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -117,7 +117,7 @@ impl BuildAst { fn flags(&self) -> Flags { match *self { Paren(flags, _, _) => flags, - _ => fail!("Cannot get flags from {}", self), + _ => panic!("Cannot get flags from {}", self), } } @@ -125,7 +125,7 @@ impl BuildAst { match *self { Paren(_, 0, _) => None, Paren(_, c, _) => Some(c), - _ => fail!("Cannot get capture group from {}", self), + _ => panic!("Cannot get capture group from {}", self), } } @@ -139,7 +139,7 @@ impl BuildAst { Some(name.clone()) } } - _ => fail!("Cannot get capture name from {}", self), + _ => panic!("Cannot get capture name from {}", self), } } @@ -153,7 +153,7 @@ impl BuildAst { fn unwrap(self) -> Result<Ast, Error> { match self { Expr(x) => Ok(x), - _ => fail!("Tried to unwrap non-AST item: {}", self), + _ => panic!("Tried to unwrap non-AST item: {}", self), } } } @@ -321,7 +321,7 @@ impl<'a> Parser<'a> { } let rep: Repeater = match c { '?' => ZeroOne, '*' => ZeroMore, '+' => OneMore, - _ => fail!("Not a valid repeater operator."), + _ => panic!("Not a valid repeater operator."), }; match self.peek(1) { @@ -393,7 +393,7 @@ impl<'a> Parser<'a> { continue } Some(ast) => - fail!("Expected Class AST but got '{}'", ast), + panic!("Expected Class AST but got '{}'", ast), // Just drop down and try to add as a regular character. None => {}, }, @@ -408,7 +408,7 @@ impl<'a> Parser<'a> { return self.err( "\\A, \\z, \\b and \\B are not valid escape \ sequences inside a character class."), - ast => fail!("Unexpected AST item '{}'", ast), + ast => panic!("Unexpected AST item '{}'", ast), } } _ => {}, diff --git a/src/libregex/re.rs b/src/libregex/re.rs index eebe9b85e3b..d352739f853 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -76,7 +76,7 @@ pub fn is_match(regex: &str, text: &str) -> Result<bool, parse::Error> { /// # use regex::Regex; /// let re = match Regex::new("[0-9]{3}-[0-9]{3}-[0-9]{4}") { /// Ok(re) => re, -/// Err(err) => fail!("{}", err), +/// Err(err) => panic!("{}", err), /// }; /// assert_eq!(re.find("phone: 111-222-3333"), Some((7, 19))); /// ``` diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs index be8e12b09f0..e1c24a902fa 100644 --- a/src/libregex/test/bench.rs +++ b/src/libregex/test/bench.rs @@ -15,7 +15,7 @@ use stdtest::Bencher; use regex::{Regex, NoExpand}; fn bench_assert_match(b: &mut Bencher, re: Regex, text: &str) { - b.iter(|| if !re.is_match(text) { fail!("no match") }); + b.iter(|| if !re.is_match(text) { panic!("no match") }); } #[bench] @@ -143,7 +143,7 @@ macro_rules! throughput( fn $name(b: &mut Bencher) { let text = gen_text($size); b.bytes = $size; - b.iter(|| if $regex.is_match(text.as_slice()) { fail!("match") }); + b.iter(|| if $regex.is_match(text.as_slice()) { panic!("match") }); } ); ) diff --git a/src/libregex/test/mod.rs b/src/libregex/test/mod.rs index 96c600b0fda..7f014b4eb68 100644 --- a/src/libregex/test/mod.rs +++ b/src/libregex/test/mod.rs @@ -30,7 +30,7 @@ macro_rules! regex( ($re:expr) => ( match ::regex::Regex::new($re) { Ok(re) => re, - Err(err) => fail!("{}", err), + Err(err) => panic!("{}", err), } ); ) diff --git a/src/libregex/test/tests.rs b/src/libregex/test/tests.rs index 088425c0888..f93a3d51251 100644 --- a/src/libregex/test/tests.rs +++ b/src/libregex/test/tests.rs @@ -75,7 +75,7 @@ macro_rules! noparse( let re = $re; match Regex::new(re) { Err(_) => {}, - Ok(_) => fail!("Regex '{}' should cause a parse error.", re), + Ok(_) => panic!("Regex '{}' should cause a parse error.", re), } } ); @@ -133,7 +133,7 @@ macro_rules! mat( sgot = sgot[0..sexpect.len()] } if sexpect != sgot { - fail!("For RE '{}' against '{}', expected '{}' but got '{}'", + panic!("For RE '{}' against '{}', expected '{}' but got '{}'", $re, text, sexpect, sgot); } } |
