File tree Expand file tree Collapse file tree 6 files changed +59
-6
lines changed Expand file tree Collapse file tree 6 files changed +59
-6
lines changed Original file line number Diff line number Diff line change 4
4
/// enables the simple extraction of the metadata without changing the current deprecation
5
5
/// declaration.
6
6
pub struct ClippyDeprecatedLint {
7
- #[ cfg( feature = "internal" ) ]
8
7
#[ allow( dead_code) ]
9
- desc : & ' static str ,
8
+ pub desc : & ' static str ,
10
9
}
11
10
11
+ #[ macro_export]
12
12
macro_rules! declare_deprecated_lint {
13
13
{ $( #[ $attr: meta] ) * pub $name: ident, $reason: literal} => {
14
14
$( #[ $attr] ) *
15
15
#[ allow( dead_code) ]
16
16
pub static $name: ClippyDeprecatedLint = ClippyDeprecatedLint {
17
- #[ cfg( feature = "internal" ) ]
18
17
desc: $reason
19
18
} ;
20
19
}
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ macro_rules! declare_clippy_lint {
159
159
}
160
160
161
161
#[ cfg( feature = "internal" ) ]
162
- mod deprecated_lints;
162
+ pub mod deprecated_lints;
163
163
#[ cfg_attr( feature = "internal" , allow( clippy:: missing_clippy_version_attribute) ) ]
164
164
mod utils;
165
165
Original file line number Diff line number Diff line change @@ -348,7 +348,6 @@ declare_clippy_lint! {
348
348
/// Indicates that the documentation is incomplete.
349
349
///
350
350
/// ### Example
351
- /// Bad:
352
351
/// ```rust,ignore
353
352
/// declare_deprecated_lint! {
354
353
/// /// ### What it does
@@ -362,7 +361,7 @@ declare_clippy_lint! {
362
361
/// }
363
362
/// ```
364
363
///
365
- /// Good :
364
+ /// Use instead :
366
365
/// ```rust,ignore
367
366
/// declare_deprecated_lint! {
368
367
/// /// ### What it does
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal");
24
24
/// All crates used in UI tests are listed here
25
25
static TEST_DEPENDENCIES : & [ & str ] = & [
26
26
"clap" ,
27
+ "clippy_lints" ,
27
28
"clippy_utils" ,
28
29
"derive_new" ,
29
30
"futures" ,
@@ -44,6 +45,8 @@ static TEST_DEPENDENCIES: &[&str] = &[
44
45
#[ allow( unused_extern_crates) ]
45
46
extern crate clap;
46
47
#[ allow( unused_extern_crates) ]
48
+ extern crate clippy_lints;
49
+ #[ allow( unused_extern_crates) ]
47
50
extern crate clippy_utils;
48
51
#[ allow( unused_extern_crates) ]
49
52
extern crate derive_new;
Original file line number Diff line number Diff line change
1
+ #![ deny( clippy:: internal) ]
2
+ #![ feature( rustc_private) ]
3
+
4
+ #[ macro_use]
5
+ extern crate clippy_lints;
6
+ use clippy_lints:: deprecated_lints:: ClippyDeprecatedLint ;
7
+
8
+ declare_deprecated_lint ! {
9
+ /// ### What it does
10
+ /// Nothing. This lint has been deprecated.
11
+ ///
12
+ /// ### Deprecation reason
13
+ /// TODO
14
+ #[ clippy:: version = "1.63.0" ]
15
+ pub COOL_LINT_DEFAULT ,
16
+ "default deprecation note"
17
+ }
18
+
19
+ declare_deprecated_lint ! {
20
+ /// ### What it does
21
+ /// Nothing. This lint has been deprecated.
22
+ ///
23
+ /// ### Deprecation reason
24
+ /// This lint has been replaced by `cooler_lint`
25
+ #[ clippy:: version = "1.63.0" ]
26
+ pub COOL_LINT ,
27
+ "this lint has been replaced by `cooler_lint`"
28
+ }
29
+
30
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: the lint `COOL_LINT_DEFAULT` has the default deprecation reason
2
+ --> $DIR/default_deprecation_reason.rs:8:1
3
+ |
4
+ LL | / declare_deprecated_lint! {
5
+ LL | | /// ### What it does
6
+ LL | | /// Nothing. This lint has been deprecated.
7
+ LL | | ///
8
+ ... |
9
+ LL | | "default deprecation note"
10
+ LL | | }
11
+ | |_^
12
+ |
13
+ note: the lint level is defined here
14
+ --> $DIR/default_deprecation_reason.rs:1:9
15
+ |
16
+ LL | #![deny(clippy::internal)]
17
+ | ^^^^^^^^^^^^^^^^
18
+ = note: `#[deny(clippy::default_deprecation_reason)]` implied by `#[deny(clippy::internal)]`
19
+ = note: this error originates in the macro `declare_deprecated_lint` (in Nightly builds, run with -Z macro-backtrace for more info)
20
+
21
+ error: aborting due to previous error
22
+
You can’t perform that action at this time.
0 commit comments