summaryrefslogtreecommitdiffstats
path: root/vendor/clap_builder/src/macros.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/clap_builder/src/macros.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap_builder/src/macros.rs')
-rw-r--r--vendor/clap_builder/src/macros.rs98
1 files changed, 2 insertions, 96 deletions
diff --git a/vendor/clap_builder/src/macros.rs b/vendor/clap_builder/src/macros.rs
index 59135e212..945cdaaab 100644
--- a/vendor/clap_builder/src/macros.rs
+++ b/vendor/clap_builder/src/macros.rs
@@ -175,8 +175,7 @@ macro_rules! arg_impl {
debug_assert_eq!(
ident_or_char_literal.len(),
1,
- "Single-letter identifier expected, got {}",
- ident_or_char_literal
+ "Single-letter identifier expected, got {ident_or_char_literal}",
);
ident_or_char_literal.chars().next().unwrap()
}};
@@ -404,7 +403,7 @@ macro_rules! arg_impl {
$arg.action($crate::ArgAction::Count)
}
action => {
- panic!("Unexpected action {:?}", action)
+ panic!("Unexpected action {action:?}")
}
};
let arg = $crate::arg_impl! {
@@ -532,99 +531,6 @@ macro_rules! arg {
}};
}
-macro_rules! impl_settings {
- ($settings:ident, $flags:ident,
- $(
- $(#[$inner:ident $($args:tt)*])*
- $setting:ident => $flag:path
- ),+
- ) => {
- impl $flags {
- #[allow(dead_code)]
- pub(crate) fn empty() -> Self {
- $flags(Flags::empty())
- }
-
- #[allow(dead_code)]
- pub(crate) fn insert(&mut self, rhs: Self) {
- self.0.insert(rhs.0);
- }
-
- #[allow(dead_code)]
- pub(crate) fn remove(&mut self, rhs: Self) {
- self.0.remove(rhs.0);
- }
-
- #[allow(dead_code)]
- pub(crate) fn set(&mut self, s: $settings) {
- match s {
- $(
- $(#[$inner $($args)*])*
- $settings::$setting => self.0.insert($flag),
- )*
- }
- }
-
- #[allow(dead_code)]
- pub(crate) fn unset(&mut self, s: $settings) {
- match s {
- $(
- $(#[$inner $($args)*])*
- $settings::$setting => self.0.remove($flag),
- )*
- }
- }
-
- #[allow(dead_code)]
- pub(crate) fn is_set(&self, s: $settings) -> bool {
- match s {
- $(
- $(#[$inner $($args)*])*
- $settings::$setting => self.0.contains($flag),
- )*
- }
- }
- }
-
- impl BitOr for $flags {
- type Output = Self;
-
- fn bitor(mut self, rhs: Self) -> Self::Output {
- self.0.insert(rhs.0);
- self
- }
- }
-
- impl From<$settings> for $flags {
- fn from(setting: $settings) -> Self {
- let mut flags = $flags::empty();
- flags.set(setting);
- flags
- }
- }
-
- impl BitOr<$settings> for $flags {
- type Output = Self;
-
- fn bitor(mut self, rhs: $settings) -> Self::Output {
- self.set(rhs);
- self
- }
- }
-
- impl BitOr for $settings {
- type Output = $flags;
-
- fn bitor(self, rhs: Self) -> Self::Output {
- let mut flags = $flags::empty();
- flags.set(self);
- flags.set(rhs);
- flags
- }
- }
- }
-}
-
#[cfg(feature = "debug")]
macro_rules! debug {
($($arg:tt)*) => ({