clippy lints
This commit is contained in:
parent
22998f0785
commit
583e26c5dd
7 changed files with 16 additions and 23 deletions
|
|
@ -99,7 +99,7 @@ fn main() {
|
|||
// HACK: Since the commit script uses hard links, we can't actually tell if it was installed by x.py setup or not.
|
||||
// We could see if it's identical to src/etc/pre-push.sh, but pre-push may have been modified in the meantime.
|
||||
// Instead, look for this comment, which is almost certainly not in any custom hook.
|
||||
if fs::read_to_string(pre_commit).map_or(false, |contents| {
|
||||
if fs::read_to_string(pre_commit).is_ok_and(|contents| {
|
||||
contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570")
|
||||
}) {
|
||||
println!(
|
||||
|
|
|
|||
|
|
@ -1655,7 +1655,7 @@ impl Step for Sysroot {
|
|||
let mut add_filtered_files = |suffix, contents| {
|
||||
for path in contents {
|
||||
let path = Path::new(&path);
|
||||
if path.parent().map_or(false, |parent| parent.ends_with(suffix)) {
|
||||
if path.parent().is_some_and(|parent| parent.ends_with(suffix)) {
|
||||
filtered_files.push(path.file_name().unwrap().to_owned());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,7 @@ fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl F
|
|||
fn get_rustfmt_version(build: &Builder<'_>) -> Option<(String, PathBuf)> {
|
||||
let stamp_file = build.out.join("rustfmt.stamp");
|
||||
|
||||
let mut cmd = command(match build.initial_rustfmt() {
|
||||
Some(p) => p,
|
||||
None => return None,
|
||||
});
|
||||
let mut cmd = command(build.initial_rustfmt()?);
|
||||
cmd.arg("--version");
|
||||
|
||||
let output = cmd.allow_failure().run_capture(build);
|
||||
|
|
@ -279,7 +276,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
|
|||
Box::new(move |entry| {
|
||||
let cwd = std::env::current_dir();
|
||||
let entry = t!(entry);
|
||||
if entry.file_type().map_or(false, |t| t.is_file()) {
|
||||
if entry.file_type().is_some_and(|t| t.is_file()) {
|
||||
formatted_paths_ref.lock().unwrap().push({
|
||||
// `into_path` produces an absolute path. Try to strip `cwd` to get a shorter
|
||||
// relative path.
|
||||
|
|
|
|||
|
|
@ -1665,7 +1665,7 @@ impl Config {
|
|||
}
|
||||
|
||||
config.llvm_assertions =
|
||||
toml.llvm.as_ref().map_or(false, |llvm| llvm.assertions.unwrap_or(false));
|
||||
toml.llvm.as_ref().is_some_and(|llvm| llvm.assertions.unwrap_or(false));
|
||||
|
||||
// Store off these values as options because if they're not provided
|
||||
// we'll infer default values for them later
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ download-rustc = false
|
|||
|
||||
fn path_is_dylib(path: &Path) -> bool {
|
||||
// The .so is not necessarily the extension, it might be libLLVM.so.18.1
|
||||
path.to_str().map_or(false, |path| path.contains(".so"))
|
||||
path.to_str().is_some_and(|path| path.contains(".so"))
|
||||
}
|
||||
|
||||
/// Checks whether the CI rustc is available for the given target triple.
|
||||
|
|
|
|||
|
|
@ -135,19 +135,15 @@ pub fn check(build: &mut Build) {
|
|||
|
||||
// We need cmake, but only if we're actually building LLVM or sanitizers.
|
||||
let building_llvm = !build.config.llvm_from_ci
|
||||
&& build
|
||||
.hosts
|
||||
.iter()
|
||||
.map(|host| {
|
||||
build.config.llvm_enabled(*host)
|
||||
&& build
|
||||
.config
|
||||
.target_config
|
||||
.get(host)
|
||||
.map(|config| config.llvm_config.is_none())
|
||||
.unwrap_or(true)
|
||||
})
|
||||
.any(|build_llvm_ourselves| build_llvm_ourselves);
|
||||
&& build.hosts.iter().any(|host| {
|
||||
build.config.llvm_enabled(*host)
|
||||
&& build
|
||||
.config
|
||||
.target_config
|
||||
.get(host)
|
||||
.map(|config| config.llvm_config.is_none())
|
||||
.unwrap_or(true)
|
||||
});
|
||||
|
||||
let need_cmake = building_llvm || build.config.any_sanitizers_to_build();
|
||||
if need_cmake && cmd_finder.maybe_have("cmake").is_none() {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ pub fn exe(name: &str, target: TargetSelection) -> String {
|
|||
|
||||
/// Returns `true` if the file name given looks like a dynamic library.
|
||||
pub fn is_dylib(path: &Path) -> bool {
|
||||
path.extension().and_then(|ext| ext.to_str()).map_or(false, |ext| {
|
||||
path.extension().and_then(|ext| ext.to_str()).is_some_and(|ext| {
|
||||
ext == "dylib" || ext == "so" || ext == "dll" || (ext == "a" && is_aix_shared_archive(path))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue