Port #[rustc_skip_during_method_dispatch] to the new attribute system

This commit is contained in:
Pavel Grigorenko
2025-06-18 22:27:35 +03:00
parent 42245d34d2
commit aa80a2b62c
17 changed files with 246 additions and 41 deletions

View File

@@ -169,9 +169,15 @@ impl<'a> ArgParser<'a> {
}
}
/// Asserts that there are no arguments
pub fn no_args(&self) -> bool {
matches!(self, Self::NoArgs)
/// Assert that there were no args.
/// If there were, get a span to the arguments
/// (to pass to [`AcceptContext::expected_no_args`](crate::context::AcceptContext::expected_no_args)).
pub fn no_args(&self) -> Result<(), Span> {
match self {
Self::NoArgs => Ok(()),
Self::List(args) => Err(args.span),
Self::NameValue(args) => Err(args.eq_span.to(args.value_span)),
}
}
}