Skip to content

Commit 07bcdd1

Browse files
authored
Merge pull request #57 from chrissimpkins/edition-2018
Transition to Edition 2018
2 parents 7ac0397 + 385c415 commit 07bcdd1

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ name = "cargo-bisect-rustc"
99
readme = "README.md"
1010
repository = "https://github.com/rust-lang/cargo-bisect-rustc"
1111
version = "0.2.1"
12+
edition = "2018"
1213

1314
[dependencies]
1415
dialoguer = "0.3.0"

src/git.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ const RUST_SRC_REPO: Option<&str> = option_env!("RUST_SRC_REPO");
1313
use std::path::Path;
1414

1515
use chrono::{DateTime, TimeZone, Utc};
16-
use failure::Error;
16+
use failure::{bail, Error};
1717
use git2::build::RepoBuilder;
1818
use git2::{Commit as Git2Commit, Repository};
19+
use log::debug;
1920

2021
#[derive(Debug, Clone, PartialEq)]
2122
pub struct Commit {
@@ -26,7 +27,7 @@ pub struct Commit {
2627

2728
impl Commit {
2829
// Takes &mut because libgit2 internally caches summaries
29-
fn from_git2_commit(commit: &mut Git2Commit) -> Self {
30+
fn from_git2_commit(commit: &mut Git2Commit<'_>) -> Self {
3031
Commit {
3132
sha: commit.id().to_string(),
3233
date: Utc.timestamp(commit.time().seconds(), 0),
@@ -83,7 +84,7 @@ pub fn get_commits_between(first_commit: &str, last_commit: &str) -> Result<Vec<
8384

8485
// Sanity check -- our algorithm below only works reliably if the
8586
// two commits are merge commits made by bors
86-
let assert_by_bors = |c: &Git2Commit| -> Result<(), Error> {
87+
let assert_by_bors = |c: &Git2Commit<'_>| -> Result<(), Error> {
8788
match c.author().name() {
8889
Some("bors") => Ok(()),
8990
Some(author) => bail!("Expected author {} to be bors for {}", author, c.id()),

src/least_satisfying.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub enum Satisfies {
174174
}
175175

176176
impl fmt::Display for Satisfies {
177-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
177+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
178178
write!(f, "{:?}", self)
179179
}
180180
}

src/main.rs

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,6 @@
55
// http://opensource.org/licenses/MIT>, at your option. This file may not be
66
// copied, modified, or distributed except according to those terms.
77

8-
extern crate chrono;
9-
extern crate dialoguer;
10-
extern crate dirs;
11-
extern crate env_logger;
12-
#[macro_use]
13-
extern crate failure;
14-
extern crate flate2;
15-
extern crate git2;
16-
#[macro_use]
17-
extern crate log;
18-
extern crate pbr;
19-
#[cfg(test)]
20-
extern crate quickcheck;
21-
extern crate regex;
22-
extern crate reqwest;
23-
extern crate rustc_version;
24-
extern crate structopt;
25-
extern crate tar;
26-
extern crate tee;
27-
extern crate tempdir;
28-
extern crate xz2;
29-
308
use std::env;
319
use std::ffi::OsString;
3210
use std::fmt;
@@ -38,8 +16,9 @@ use std::str::FromStr;
3816

3917
use chrono::{Date, Duration, naive, Utc};
4018
use dialoguer::Select;
41-
use failure::Error;
19+
use failure::{bail, format_err, Fail, Error};
4220
use flate2::read::GzDecoder;
21+
use log::debug;
4322
use pbr::{ProgressBar, Units};
4423
use regex::Regex;
4524
use reqwest::header::CONTENT_LENGTH;
@@ -51,6 +30,11 @@ use tee::TeeReader;
5130
use tempdir::TempDir;
5231
use xz2::read::XzDecoder;
5332

33+
mod git;
34+
mod least_satisfying;
35+
36+
use crate::least_satisfying::{least_satisfying, Satisfies};
37+
5438
/// The first commit which build artifacts are made available through the CI for
5539
/// bisection.
5640
///
@@ -62,10 +46,6 @@ const EPOCH_COMMIT: &str = "927c55d86b0be44337f37cf5b0a76fb8ba86e06c";
6246
const NIGHTLY_SERVER: &str = "https://static.rust-lang.org/dist";
6347
const CI_SERVER: &str = "https://s3-us-west-1.amazonaws.com/rust-lang-ci2";
6448

65-
mod git;
66-
mod least_satisfying;
67-
use least_satisfying::{least_satisfying, Satisfies};
68-
6949
fn get_commits(start: &str, end: &str) -> Result<Vec<git::Commit>, Error> {
7050
eprintln!("fetching commits from {} to {}", start, end);
7151
let commits = git::get_commits_between(start, end)?;
@@ -233,7 +213,7 @@ impl Opts {
233213
struct ExitError(i32);
234214

235215
impl fmt::Display for ExitError {
236-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
216+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
237217
write!(f, "exiting with {}", self.0)
238218
}
239219
}
@@ -252,7 +232,7 @@ enum ToolchainSpec {
252232
}
253233

254234
impl fmt::Display for ToolchainSpec {
255-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
235+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
256236
match *self {
257237
ToolchainSpec::Ci { ref commit, alt } => {
258238
let alt_s = if alt { format!("-alt") } else { String::new() };
@@ -280,7 +260,7 @@ impl Toolchain {
280260
}
281261

282262
impl fmt::Display for Toolchain {
283-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
263+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
284264
match self.spec {
285265
ToolchainSpec::Ci { ref commit, alt } => {
286266
let alt_s = if alt { format!("-alt") } else { String::new() };

0 commit comments

Comments
 (0)