Skip to content

Commit fcd8067

Browse files
committed
#446 feat: enable clippy format args linting inside exported macros
1 parent ed5a512 commit fcd8067

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/macros.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
/// assert!(bounded(2, 3).is_ok());
7373
/// assert!(bounded(5, 3).is_err());
7474
/// ```
75+
///
76+
/// Clippy format-args lints (such as `clippy::uninlined_format_args`) see
77+
/// through this macro and lint format arguments passed inside it.
7578
#[macro_export]
79+
#[clippy::format_args]
7680
macro_rules! ensure {
7781
(cond = $cond:expr, else = $err:expr $(,)?) => {
7882
$crate::ensure!($cond, $err)
@@ -102,7 +106,11 @@ macro_rules! ensure {
102106
/// let err = reject().unwrap_err();
103107
/// assert!(matches!(err.kind, AppErrorKind::Unauthorized));
104108
/// ```
109+
///
110+
/// Clippy format-args lints (such as `clippy::uninlined_format_args`) see
111+
/// through this macro and lint format arguments passed inside it.
105112
#[macro_export]
113+
#[clippy::format_args]
106114
macro_rules! fail {
107115
($err:expr $(,)?) => {
108116
return Err($err);
@@ -170,7 +178,11 @@ macro_rules! fail {
170178
/// AppErrorKind::Unauthorized
171179
/// ));
172180
/// ```
181+
///
182+
/// Clippy format-args lints (such as `clippy::uninlined_format_args`) see
183+
/// through this macro and lint the format string and arguments directly.
173184
#[macro_export]
185+
#[clippy::format_args]
174186
macro_rules! app_error {
175187
($kind:expr $(,)?) => {
176188
$crate::AppError::bare($kind)

0 commit comments

Comments
 (0)