Skip to content

Commit 4c4e8e7

Browse files
authored
Rollup merge of #80533 - matthiaskrgr:bootstrap_clppy, r=Mark-Simulacrum
bootstrap: clippy fixes addresses: clippy::or_fun_call clippy::single_char_add_str clippy::comparison_to_empty clippy::or_fun_call
2 parents bdf8bbd + 87423fb commit 4c4e8e7

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ impl Rustflags {
15341534
fn arg(&mut self, arg: &str) -> &mut Self {
15351535
assert_eq!(arg.split(' ').count(), 1);
15361536
if !self.0.is_empty() {
1537-
self.0.push_str(" ");
1537+
self.0.push(' ');
15381538
}
15391539
self.0.push_str(arg);
15401540
self

src/bootstrap/channel.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl GitInfo {
7474
if let Some(ref inner) = self.inner {
7575
version.push_str(" (");
7676
version.push_str(&inner.short_sha);
77-
version.push_str(" ");
77+
version.push(' ');
7878
version.push_str(&inner.commit_date);
79-
version.push_str(")");
79+
version.push(')');
8080
}
8181
version
8282
}

src/bootstrap/dist.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1326,17 +1326,17 @@ impl Step for Extended {
13261326
license += &builder.read(&builder.src.join("COPYRIGHT"));
13271327
license += &builder.read(&builder.src.join("LICENSE-APACHE"));
13281328
license += &builder.read(&builder.src.join("LICENSE-MIT"));
1329-
license.push_str("\n");
1330-
license.push_str("\n");
1329+
license.push('\n');
1330+
license.push('\n');
13311331

13321332
let rtf = r"{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}\nowwrap\fs18";
13331333
let mut rtf = rtf.to_string();
1334-
rtf.push_str("\n");
1334+
rtf.push('\n');
13351335
for line in license.lines() {
13361336
rtf.push_str(line);
13371337
rtf.push_str("\\line ");
13381338
}
1339-
rtf.push_str("}");
1339+
rtf.push('}');
13401340

13411341
fn filter(contents: &str, marker: &str) -> String {
13421342
let start = format!("tool-{}-start", marker);

src/bootstrap/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ impl Build {
10831083
if let Some(ref s) = self.config.description {
10841084
version.push_str(" (");
10851085
version.push_str(s);
1086-
version.push_str(")");
1086+
version.push(')');
10871087
}
10881088
version
10891089
}
@@ -1144,7 +1144,7 @@ impl Build {
11441144
&& (dep != "profiler_builtins"
11451145
|| target
11461146
.map(|t| self.config.profiler_enabled(t))
1147-
.unwrap_or(self.config.any_profiler_enabled()))
1147+
.unwrap_or_else(|| self.config.any_profiler_enabled()))
11481148
&& (dep != "rustc_codegen_llvm" || self.config.llvm_enabled())
11491149
{
11501150
list.push(*dep);

src/bootstrap/sanity.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ pub fn check(build: &mut Build) {
163163
panic!("the iOS target is only supported on macOS");
164164
}
165165

166-
build.config.target_config.entry(*target).or_insert(Target::from_triple(&target.triple));
166+
build
167+
.config
168+
.target_config
169+
.entry(*target)
170+
.or_insert_with(|| Target::from_triple(&target.triple));
167171

168172
if target.contains("-none-") || target.contains("nvptx") {
169173
if build.no_std(*target) == Some(false) {

src/bootstrap/setup.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn setup(src_path: &Path, profile: Profile) {
8989
std::process::exit(1);
9090
}
9191

92-
let path = cfg_file.unwrap_or("config.toml".into());
92+
let path = cfg_file.unwrap_or_else(|| "config.toml".into());
9393
let settings = format!(
9494
"# Includes one of the default files in src/bootstrap/defaults\n\
9595
profile = \"{}\"\n\
@@ -156,7 +156,7 @@ pub fn interactive_path() -> io::Result<Profile> {
156156
io::stdout().flush()?;
157157
let mut input = String::new();
158158
io::stdin().read_line(&mut input)?;
159-
if input == "" {
159+
if input.is_empty() {
160160
eprintln!("EOF on stdin, when expecting answer to question. Giving up.");
161161
std::process::exit(1);
162162
}

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
11351135
// flag is respected, so providing an empty --test-args conflicts with
11361136
// any following it.
11371137
match p.strip_prefix(suite_path).ok().and_then(|p| p.to_str()) {
1138-
Some(s) if s != "" => Some(s),
1138+
Some(s) if !s.is_empty() => Some(s),
11391139
_ => None,
11401140
}
11411141
})

0 commit comments

Comments
 (0)