Skip to content

Commit

Permalink
remove: cfg(has_not_matches)
Browse files Browse the repository at this point in the history
  • Loading branch information
aki-akaguma committed Jun 19, 2024
1 parent dda5261 commit cbebca9
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
* rename: `config` to `config.toml`
* remove: `cfg(has_not_matches)`
* refactored `Makefile`
* update depends: flood-tide(0.2.9), flood-tide-gen(0.1.20)
* update depends: memx-cdy(0.1.11), runnel(0.3.16)
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ assert-text = "0.2"

[build-dependencies]
rust-version-info-file = "0.1"
rustc_version = "0.4"

[workspace]
members = [
Expand Down
7 changes: 0 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// build.rs
use rust_version_info_file::rust_version_info_file;
use rustc_version as rs_v;

fn main() {
let rt_version = rs_v::version().unwrap();
//
if rt_version < rs_v::Version::parse("1.42.0").unwrap() {
println!("cargo:rustc-cfg=has_not_matches");
}
//
let path = {
#[cfg(feature = "debian_build")]
let dir = "target".to_string();
Expand Down
18 changes: 1 addition & 17 deletions src/util/err.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
#[cfg(has_not_matches)]
macro_rules! my_matches {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
match $expression {
$( $pattern )|+ $( if $guard )? => true,
_ => false
}
}
}
#[cfg(not(has_not_matches))]
macro_rules! my_matches {
($expression:expr, $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
matches!($expression, $( $pattern )|+ $( if $guard )?)
}
}

pub trait BrokenPipeError {
fn is_broken_pipe(&self) -> bool;
}

impl BrokenPipeError for anyhow::Error {
fn is_broken_pipe(&self) -> bool {
my_matches!(self.downcast_ref::<std::io::Error>(),
matches!(self.downcast_ref::<std::io::Error>(),
Some(ioe) if ioe.kind() == std::io::ErrorKind::BrokenPipe)
}
}
Expand Down

0 comments on commit cbebca9

Please sign in to comment.