File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ fn main() {
70
70
if rustc >= 80 {
71
71
println ! ( "cargo:rustc-check-cfg=cfg(anyhow_build_probe)" ) ;
72
72
println ! ( "cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)" ) ;
73
+ println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_clippy_format_args)" ) ;
73
74
println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_core_error)" ) ;
74
75
println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_core_unwind_safe)" ) ;
75
76
println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)" ) ;
@@ -112,6 +113,12 @@ fn main() {
112
113
// https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror
113
114
println ! ( "cargo:rustc-cfg=anyhow_no_core_error" ) ;
114
115
}
116
+
117
+ if rustc < 85 {
118
+ // #[clippy::format_args]
119
+ // https://doc.rust-lang.org/1.85.1/clippy/attribs.html#clippyformat_args
120
+ println ! ( "cargo:rustc-cfg=anyhow_no_clippy_format_args" ) ;
121
+ }
115
122
}
116
123
117
124
fn compile_probe ( rustc_bootstrap : bool ) -> bool {
Original file line number Diff line number Diff line change 54
54
/// # }
55
55
/// ```
56
56
#[ macro_export]
57
+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
57
58
macro_rules! bail {
58
59
( $msg: literal $( , ) ?) => {
59
60
return $crate:: __private:: Err ( $crate:: __anyhow!( $msg) )
@@ -154,6 +155,7 @@ __ensure![
154
155
#[ cfg( not( doc) ) ]
155
156
__ensure ! [
156
157
#[ macro_export]
158
+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
157
159
macro_rules! ensure {
158
160
( $( $tt: tt) * ) => {
159
161
$crate :: __parse_ensure!(
@@ -198,6 +200,7 @@ __ensure![
198
200
/// }
199
201
/// ```
200
202
#[ macro_export]
203
+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
201
204
macro_rules! anyhow {
202
205
( $msg: literal $( , ) ?) => {
203
206
$crate:: __private:: must_use( {
You can’t perform that action at this time.
0 commit comments