mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 23:37:32 +00:00
refactor: Allow partially used genned code
Wow, I'm having a hard time summarizing this for the summary. When we code-gen Settings using `impl_settings`, we have no control over whether one instance of a Settings will use some or all functions. I have a fix that removes the one `ArgSettings::unset`, causing warnings for `ArgSettings` despite needing it for `AppSettings`. So I'm making it less dependent on how each instantiation uses it.
This commit is contained in:
parent
2ce916133b
commit
391980286e
1 changed files with 6 additions and 0 deletions
|
@ -536,18 +536,22 @@ macro_rules! impl_settings {
|
|||
),+
|
||||
) => {
|
||||
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 {
|
||||
$(
|
||||
|
@ -557,6 +561,7 @@ macro_rules! impl_settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn unset(&mut self, s: $settings) {
|
||||
match s {
|
||||
$(
|
||||
|
@ -566,6 +571,7 @@ macro_rules! impl_settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn is_set(&self, s: $settings) -> bool {
|
||||
match s {
|
||||
$(
|
||||
|
|
Loading…
Add table
Reference in a new issue