Skip to content

Commit 56e5d46

Browse files
committed
Update regex to 0.2
1 parent 0e3fa78 commit 56e5d46

File tree

6 files changed

+12
-65
lines changed

6 files changed

+12
-65
lines changed

Cargo.lock

Lines changed: 1 addition & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build = "build.rs"
1010
[dependencies]
1111
log = "0.3"
1212
rustc-serialize = "0.3"
13-
regex = "0.1"
13+
regex = "0.2"
1414
clap = "2"
1515
crates-index-diff = "3"
1616
git2 = "0.6"

src/db/add_package.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ fn add_authors_into_database(conn: &Connection, pkg: &Package, release_id: &i32)
351351
let author_capture_re = Regex::new("^([^><]+)<*(.*?)>*$").unwrap();
352352
for author in &pkg.manifest().metadata().authors {
353353
if let Some(author_captures) = author_capture_re.captures(&author[..]) {
354-
let author = author_captures.at(1).unwrap_or("").trim();
355-
let email = author_captures.at(2).unwrap_or("").trim();
354+
let author = author_captures.get(1).map(|m| m.as_str()).unwrap_or("").trim();
355+
let email = author_captures.get(2).map(|m| m.as_str()).unwrap_or("").trim();
356356
let slug = slugify(&author);
357357

358358
let author_id: i32 = {

src/docbuilder/chroot_builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ fn parse_rustc_version<S: AsRef<str>>(version: S) -> String {
445445
let captures = version_regex.captures(version.as_ref()).expect("Failed to parse rustc version");
446446

447447
format!("{}{}{}-{}-{}",
448-
captures.at(3).unwrap(),
449-
captures.at(4).unwrap(),
450-
captures.at(5).unwrap(),
451-
captures.at(1).unwrap(),
452-
captures.at(2).unwrap())
448+
captures.get(3).unwrap().as_str(),
449+
captures.get(4).unwrap().as_str(),
450+
captures.get(5).unwrap().as_str(),
451+
captures.get(1).unwrap().as_str(),
452+
captures.get(2).unwrap().as_str())
453453
}
454454

455455

src/utils/copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn copy_html(source: &PathBuf,
110110
let mut line = try!(line);
111111

112112
// replace css links
113-
line = replace_regex.replace_all(&line[..], &replace_str[..]);
113+
line = replace_regex.replace_all(&line[..], &replace_str[..]).into_owned();
114114

115115
try!(destination_file.write(line.as_bytes()));
116116
// need to write consumed newline

src/utils/github_updater.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ fn get_github_path(url: &str) -> Option<String> {
122122
let re = Regex::new(r"https?://github\.com/([\w\._-]+)/([\w\._-]+)").unwrap();
123123
match re.captures(url) {
124124
Some(cap) => {
125-
let username = cap.at(1).unwrap();
126-
let reponame = cap.at(2).unwrap();
125+
let username = cap.get(1).unwrap().as_str();
126+
let reponame = cap.get(2).unwrap().as_str();
127127
Some(format!("{}/{}",
128128
username,
129129
if reponame.ends_with(".git") {

0 commit comments

Comments
 (0)