Skip to content

Commit 95c3443

Browse files
committed
address clippy lint issues in main.rs + toolchains.rs
1 parent e153a0f commit 95c3443

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ enum Bound {
163163
#[fail(display = "will never happen")]
164164
struct BoundParseError {}
165165

166-
const YYYY_MM_DD: &'static str = "%Y-%m-%d";
166+
const YYYY_MM_DD: &str = "%Y-%m-%d";
167167

168168
impl FromStr for Bound {
169169
type Err = BoundParseError;
@@ -344,7 +344,7 @@ impl CommandTemplate {
344344
}
345345

346346
fn command(&self) -> Command {
347-
assert!(self.0.len() > 0);
347+
assert!(!self.0.is_empty());
348348
let mut cmd = Command::new(&self.0[0]);
349349
for arg in &self.0[1..] {
350350
cmd.arg(arg);
@@ -353,7 +353,7 @@ impl CommandTemplate {
353353
}
354354

355355
fn string(&self) -> String {
356-
assert!(self.0.len() > 0);
356+
assert!(!self.0.is_empty());
357357
let mut s = self.0[0].to_string();
358358
for arg in &self.0[1..] {
359359
s.push_str(" ");
@@ -509,7 +509,7 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
509509
let sha = cfg.repo_access.commit(sha)?.sha;
510510
let mut t = Toolchain {
511511
spec: ToolchainSpec::Ci {
512-
commit: sha.clone(),
512+
commit: sha,
513513
alt: cfg.args.alt,
514514
},
515515
host: cfg.args.host.clone(),
@@ -522,7 +522,7 @@ fn install(cfg: &Config, client: &Client, bound: &Bound) -> Result<(), Error> {
522522
}
523523
Bound::Date(date) => {
524524
let mut t = Toolchain {
525-
spec: ToolchainSpec::Nightly { date: date },
525+
spec: ToolchainSpec::Nightly { date },
526526
host: cfg.args.host.clone(),
527527
std_targets: vec![cfg.args.host.clone(), cfg.target.clone()],
528528
};
@@ -779,7 +779,7 @@ fn install_and_test(
779779
}
780780

781781
fn bisect_to_regression(
782-
toolchains: &Vec<Toolchain>,
782+
toolchains: &[Toolchain],
783783
cfg: &Config,
784784
client: &Client,
785785
dl_spec: &DownloadParams) -> Result<usize, InstallError>
@@ -922,7 +922,7 @@ fn toolchains_between(cfg: &Config, a: ToolchainSpec, b: ToolchainSpec) -> Vec<T
922922
let mut date = a;
923923
while date <= b {
924924
let mut t = Toolchain {
925-
spec: ToolchainSpec::Nightly { date: date },
925+
spec: ToolchainSpec::Nightly { date },
926926
host: cfg.args.host.clone(),
927927
std_targets: vec![cfg.args.host.clone(), cfg.target.clone()],
928928
};
@@ -1017,7 +1017,7 @@ fn bisect_ci_in_commits(
10171017
.map(|commit| {
10181018
let mut t = Toolchain {
10191019
spec: ToolchainSpec::Ci {
1020-
commit: commit.sha.clone(),
1020+
commit: commit.sha,
10211021
alt: cfg.args.alt,
10221022
},
10231023
host: cfg.args.host.clone(),

src/toolchains.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::{Config, CommandTemplate};
3030

3131
pub type GitDate = Date<Utc>;
3232

33-
const YYYY_MM_DD: &'static str = "%Y-%m-%d";
33+
const YYYY_MM_DD: &str = "%Y-%m-%d";
3434

3535
pub(crate) const NIGHTLY_SERVER: &str = "https://static.rust-lang.org/dist";
3636
const CI_SERVER: &str = "https://s3-us-west-1.amazonaws.com/rust-lang-ci2";
@@ -70,7 +70,7 @@ impl fmt::Display for Toolchain {
7070
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7171
match self.spec {
7272
ToolchainSpec::Ci { ref commit, alt } => {
73-
let alt_s = if alt { format!("-alt") } else { String::new() };
73+
let alt_s = if alt { "-alt".to_string() } else { String::new() };
7474
write!(f, "{}{}", commit, alt_s)
7575
}
7676
ToolchainSpec::Nightly { ref date } => write!(f, "nightly-{}", date.format(YYYY_MM_DD)),
@@ -82,7 +82,7 @@ impl Toolchain {
8282
pub(crate) fn rustup_name(&self) -> String {
8383
match self.spec {
8484
ToolchainSpec::Ci { ref commit, alt } => {
85-
let alt_s = if alt { format!("-alt") } else { String::new() };
85+
let alt_s = if alt { "-alt".to_string() } else { String::new() };
8686
format!("bisector-ci-{}{}-{}", commit, alt_s, self.host)
8787
}
8888
// N.B. We need to call this with a nonstandard name so that rustup utilizes the
@@ -152,7 +152,7 @@ impl Toolchain {
152152
let cmd = CommandTemplate::new(
153153
["rustc", "--print", "sysroot"]
154154
.iter()
155-
.map(|s| s.to_string()),
155+
.map(|s| (*s).to_string()),
156156
);
157157
let stdout = cmd.output()?.stdout;
158158
let output = String::from_utf8_lossy(&stdout);
@@ -166,7 +166,7 @@ impl Toolchain {
166166
let cmd = CommandTemplate::new(
167167
["rustup", "toolchain", "link"]
168168
.iter()
169-
.map(|s| s.to_string())
169+
.map(|s| (*s).to_string())
170170
.chain(iter::once(self.rustup_name()))
171171
.chain(iter::once(nightly_path)),
172172
);
@@ -203,7 +203,7 @@ impl Toolchain {
203203
match e {
204204
DownloadError::NotFound(url) => {
205205
return Err(InstallError::NotFound {
206-
url: url,
206+
url,
207207
spec: self.spec.clone(),
208208
})
209209
}
@@ -390,7 +390,7 @@ impl fmt::Display for ToolchainSpec {
390390
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
391391
match *self {
392392
ToolchainSpec::Ci { ref commit, alt } => {
393-
let alt_s = if alt { format!("-alt") } else { String::new() };
393+
let alt_s = if alt { "-alt".to_string() } else { String::new() };
394394
write!(f, "{}{}", commit, alt_s)
395395
}
396396
ToolchainSpec::Nightly { ref date } => write!(f, "nightly-{}", date),
@@ -425,7 +425,7 @@ impl DownloadParams {
425425

426426
pub(crate) fn from_cfg_with_url_prefix(cfg: &Config, url_prefix: String) -> Self {
427427
DownloadParams {
428-
url_prefix: url_prefix,
428+
url_prefix,
429429
tmp_dir: cfg.rustup_tmp_path.clone(),
430430
install_dir: cfg.toolchains_path.clone(),
431431
install_cargo: cfg.args.with_cargo,

0 commit comments

Comments
 (0)