Skip to content

Commit

Permalink
refactor(build.rs): replace matches! with is_some_and
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Jan 11, 2024
1 parent 031e962 commit 120e1f9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hermit/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::env;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::str;
Expand All @@ -8,12 +7,10 @@ use flate2::read::GzDecoder;
use tar::Archive;

fn main() {
// TODO: Replace with is_some_with once stabilized
// https://github.com/rust-lang/rust/issues/93050
let targets_hermit =
matches!(env::var_os("CARGO_CFG_TARGET_OS"), Some(os) if os == OsStr::new("hermit"));
env::var_os("CARGO_CFG_TARGET_OS").is_some_and(|target_os| target_os == "hermit");
let runs_clippy =
matches!(env::var_os("CARGO_CFG_FEATURE"), Some(os) if os == OsStr::new("cargo-clippy"));
env::var_os("CARGO_CFG_FEATURE").is_some_and(|feature| feature == "cargo-clippy");
let is_docs_rs = env::var_os("DOCS_RS").is_some();
if !targets_hermit || runs_clippy || is_docs_rs {
return;
Expand Down

0 comments on commit 120e1f9

Please sign in to comment.