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() {
7070 if rustc >= 80 {
7171 println ! ( "cargo:rustc-check-cfg=cfg(anyhow_build_probe)" ) ;
7272 println ! ( "cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)" ) ;
73+ println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_clippy_format_args)" ) ;
7374 println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_core_error)" ) ;
7475 println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_core_unwind_safe)" ) ;
7576 println ! ( "cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)" ) ;
@@ -112,6 +113,12 @@ fn main() {
112113 // https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror
113114 println ! ( "cargo:rustc-cfg=anyhow_no_core_error" ) ;
114115 }
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+ }
115122}
116123
117124fn compile_probe ( rustc_bootstrap : bool ) -> bool {
Original file line number Diff line number Diff line change 5454/// # }
5555/// ```
5656#[ macro_export]
57+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
5758macro_rules! bail {
5859 ( $msg: literal $( , ) ?) => {
5960 return $crate:: __private:: Err ( $crate:: __anyhow!( $msg) )
@@ -154,6 +155,7 @@ __ensure![
154155#[ cfg( not( doc) ) ]
155156__ensure ! [
156157 #[ macro_export]
158+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
157159 macro_rules! ensure {
158160 ( $( $tt: tt) * ) => {
159161 $crate :: __parse_ensure!(
@@ -198,6 +200,7 @@ __ensure![
198200/// }
199201/// ```
200202#[ macro_export]
203+ #[ cfg_attr( not( anyhow_no_clippy_format_args) , clippy:: format_args) ]
201204macro_rules! anyhow {
202205 ( $msg: literal $( , ) ?) => {
203206 $crate:: __private:: must_use( {
You can’t perform that action at this time.
0 commit comments