Upgrade rust/crates/regex to 1.5.4
Test: make
Change-Id: I0eab39246dc2aea41a62c15661e350b490f06c1d
diff --git a/src/lib.rs b/src/lib.rs
index 357ac0d..7f2dec8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,12 +22,6 @@
regex = "1"
```
-If you're using Rust 2015, then you'll also need to add it to your crate root:
-
-```rust
-extern crate regex;
-```
-
# Example: find a date
General use of regular expressions in this package involves compiling an
@@ -68,9 +62,7 @@
For example:
```rust
-#[macro_use] extern crate lazy_static;
-extern crate regex;
-
+use lazy_static::lazy_static;
use regex::Regex;
fn some_helper_function(text: &str) -> bool {
@@ -94,7 +86,7 @@
them by their component pieces:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(\d{4})-(\d{2})-(\d{2})").unwrap();
let text = "2012-03-14, 2013-01-01 and 2014-07-05";
@@ -119,7 +111,7 @@
in our replacement text:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2})").unwrap();
let before = "2012-03-14, 2013-01-01 and 2014-07-05";
@@ -136,7 +128,7 @@
enable insignificant whitespace mode, which also lets you write comments:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(?x)
(?P<y>\d{4}) # the year
@@ -217,7 +209,7 @@
in your expression:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(?i)Δ+").unwrap();
let mat = re.find("ΔδΔ").unwrap();
@@ -244,7 +236,7 @@
match a sequence of numerals, Greek or Cherokee letters:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"[\pN\p{Greek}\p{Cherokee}]+").unwrap();
let mat = re.find("abcΔᎠβⅠᏴγδⅡxyz").unwrap();
@@ -391,7 +383,7 @@
case-insensitively for the first part but case-sensitively for the second part:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(?i)a+(?-i)b+").unwrap();
let cap = re.captures("AaAaAbbBBBb").unwrap();
@@ -425,7 +417,7 @@
word boundary:
```rust
-# extern crate regex; use regex::Regex;
+# use regex::Regex;
# fn main() {
let re = Regex::new(r"(?-u:\b).+(?-u:\b)").unwrap();
let cap = re.captures("$$abc$$").unwrap();
@@ -614,38 +606,30 @@
*/
#![deny(missing_docs)]
-#![cfg_attr(test, deny(warnings))]
#![cfg_attr(feature = "pattern", feature(pattern))]
#![warn(missing_debug_implementations)]
#[cfg(not(feature = "std"))]
compile_error!("`std` feature is currently required to build this crate");
-#[cfg(feature = "perf-literal")]
-extern crate aho_corasick;
-// #[cfg(doctest)]
-// extern crate doc_comment;
-#[cfg(feature = "perf-literal")]
-extern crate memchr;
-#[cfg(test)]
-#[cfg_attr(feature = "perf-literal", macro_use)]
-extern crate quickcheck;
-extern crate regex_syntax as syntax;
-
+// To check README's example
+// TODO: Re-enable this once the MSRV is 1.43 or greater.
+// See: https://github.com/rust-lang/regex/issues/684
+// See: https://github.com/rust-lang/regex/issues/685
// #[cfg(doctest)]
// doc_comment::doctest!("../README.md");
#[cfg(feature = "std")]
-pub use error::Error;
+pub use crate::error::Error;
#[cfg(feature = "std")]
-pub use re_builder::set_unicode::*;
+pub use crate::re_builder::set_unicode::*;
#[cfg(feature = "std")]
-pub use re_builder::unicode::*;
+pub use crate::re_builder::unicode::*;
#[cfg(feature = "std")]
-pub use re_set::unicode::*;
+pub use crate::re_set::unicode::*;
#[cfg(feature = "std")]
#[cfg(feature = "std")]
-pub use re_unicode::{
+pub use crate::re_unicode::{
escape, CaptureLocations, CaptureMatches, CaptureNames, Captures,
Locations, Match, Matches, NoExpand, Regex, Replacer, ReplacerRef, Split,
SplitN, SubCaptureMatches,
@@ -740,10 +724,10 @@
*/
#[cfg(feature = "std")]
pub mod bytes {
- pub use re_builder::bytes::*;
- pub use re_builder::set_bytes::*;
- pub use re_bytes::*;
- pub use re_set::bytes::*;
+ pub use crate::re_builder::bytes::*;
+ pub use crate::re_builder::set_bytes::*;
+ pub use crate::re_bytes::*;
+ pub use crate::re_set::bytes::*;
}
mod backtrack;
@@ -754,8 +738,6 @@
mod exec;
mod expand;
mod find_byte;
-#[cfg(feature = "perf-literal")]
-mod freqs;
mod input;
mod literal;
#[cfg(feature = "pattern")]
@@ -777,9 +759,9 @@
#[doc(hidden)]
#[cfg(feature = "std")]
pub mod internal {
- pub use compile::Compiler;
- pub use exec::{Exec, ExecBuilder};
- pub use input::{Char, CharInput, Input, InputAt};
- pub use literal::LiteralSearcher;
- pub use prog::{EmptyLook, Inst, InstRanges, Program};
+ pub use crate::compile::Compiler;
+ pub use crate::exec::{Exec, ExecBuilder};
+ pub use crate::input::{Char, CharInput, Input, InputAt};
+ pub use crate::literal::LiteralSearcher;
+ pub use crate::prog::{EmptyLook, Inst, InstRanges, Program};
}