@@ -33,6 +33,39 @@ declare_clippy_lint! {
33
33
///
34
34
/// To fix this problem, either increase your MSRV or use another item
35
35
/// available in your current MSRV.
36
+ ///
37
+ /// You can also locally change the MSRV that should be checked by Clippy,
38
+ /// for example if a feature in your crate (e.g., `modern_compiler`) should
39
+ /// allow you to use an item:
40
+ ///
41
+ /// ```no_run
42
+ /// //! This crate has a MSRV of 1.3.0, but we also have an optional feature
43
+ /// //! `sleep_well` which requires at least Rust 1.4.0.
44
+ ///
45
+ /// // When the `sleep_well` feature is set, do not warn for functions available
46
+ /// // in Rust 1.4.0 and below.
47
+ /// #![cfg_attr(feature = "sleep_well", clippy::msrv = "1.4.0")]
48
+ ///
49
+ /// use std::time::Duration;
50
+ ///
51
+ /// #[cfg(feature = "sleep_well")]
52
+ /// fn sleep_for_some_time() {
53
+ /// std::thread::sleep(Duration::new(1, 0)); // Will not trigger the lint
54
+ /// }
55
+ /// ```
56
+ ///
57
+ /// You can also increase the MSRV in tests, by using:
58
+ ///
59
+ /// ```no_run
60
+ /// // Use a much higher MSRV for tests while keeping the main one low
61
+ /// #![cfg_attr(test, clippy::msrv = "1.85.0")]
62
+ ///
63
+ /// #[test]
64
+ /// fn my_test() {
65
+ /// // The tests can use items introduced in Rust 1.85.0 and lower
66
+ /// // without triggering the `incompatible_msrv` lint.
67
+ /// }
68
+ /// ```
36
69
#[ clippy:: version = "1.78.0" ]
37
70
pub INCOMPATIBLE_MSRV ,
38
71
suspicious,
0 commit comments