@@ -48,38 +48,106 @@ extern crate proc_macro;
4848
4949use proc_macro:: TokenStream ;
5050
51+ /// `#[flexpect::e(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
52+ ///
53+ /// # Example
54+ ///
55+ /// ```
56+ /// #[flexpect::e(clippy::clone_on_copy)]
57+ /// fn clippy_example() {
58+ /// let _ = 32.clone();
59+ /// }
60+ /// ```
5161#[ rustversion:: any( before( 1.43 . 0 ) ) ]
5262#[ proc_macro_attribute]
5363pub fn e ( _attr_args : TokenStream , item : TokenStream ) -> TokenStream {
5464 // using #[allow(...)] does not work before 1.43.0 due to a bug
5565 item
5666}
5767
68+ /// `#[flexpect::e(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
69+ ///
70+ /// # Example
71+ ///
72+ /// ```
73+ /// #[flexpect::e(clippy::clone_on_copy)]
74+ /// fn clippy_example() {
75+ /// let _ = 32.clone();
76+ /// }
77+ /// ```
5878#[ rustversion:: all( since( 1.43 . 0 ) , before( 1.81 ) ) ]
5979#[ proc_macro_attribute]
6080pub fn e ( attr_args : TokenStream , item : TokenStream ) -> TokenStream {
6181 create_attr ( "allow" , attr_args, item)
6282}
6383
84+ /// `#[flexpect::e(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
85+ ///
86+ /// # Example
87+ ///
88+ /// ```
89+ /// #[flexpect::e(clippy::clone_on_copy)]
90+ /// fn clippy_example() {
91+ /// let _ = 32.clone();
92+ /// }
93+ /// ```
6494#[ rustversion:: since( 1.81 ) ]
6595#[ proc_macro_attribute]
6696pub fn e ( attr_args : TokenStream , item : TokenStream ) -> TokenStream {
6797 create_attr ( "expect" , attr_args, item)
6898}
6999
100+ /// `#[flexpect(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
101+ ///
102+ /// # Example
103+ ///
104+ /// ```
105+ /// use flexpect::flexpect;
106+ ///
107+ /// #[flexpect(clippy::clone_on_copy)] // instead of #[expect(clippy::clone_on_copy)]
108+ /// fn clippy_example() {
109+ /// let _ = 32.clone();
110+ /// }
111+ /// ```
70112#[ rustversion:: any( before( 1.43 . 0 ) ) ]
71113#[ proc_macro_attribute]
72114pub fn flexpect ( _attr_args : TokenStream , item : TokenStream ) -> TokenStream {
73115 // using #[allow(...)] does not work before 1.43.0 due to a bug
74116 item
75117}
76118
119+ /// `#[flexpect(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
120+ ///
121+ /// # Example
122+ ///
123+ /// ```
124+ /// use flexpect::flexpect;
125+ ///
126+ /// // instead of #[expect(clippy::clone_on_copy)]
127+ /// #[flexpect(clippy::clone_on_copy)]
128+ /// fn clippy_example() {
129+ /// let _ = 32.clone();
130+ /// }
131+ /// ```
77132#[ rustversion:: all( since( 1.43 . 0 ) , before( 1.81 ) ) ]
78133#[ proc_macro_attribute]
79134pub fn flexpect ( attr_args : TokenStream , item : TokenStream ) -> TokenStream {
80135 create_attr ( "allow" , attr_args, item)
81136}
82137
138+ /// `#[flexpect(...)]` compiles to `#[expect(...)]` for newer versions of Rust and to `#[allow(...)]` when not supported.
139+ ///
140+ /// # Example
141+ ///
142+ /// ```
143+ /// use flexpect::flexpect;
144+ ///
145+ /// // instead of #[expect(clippy::clone_on_copy)]
146+ /// #[flexpect(clippy::clone_on_copy)]
147+ /// fn clippy_example() {
148+ /// let _ = 32.clone();
149+ /// }
150+ /// ```
83151#[ rustversion:: since( 1.81 ) ]
84152#[ proc_macro_attribute]
85153pub fn flexpect ( attr_args : TokenStream , item : TokenStream ) -> TokenStream {
0 commit comments