@@ -75,7 +75,7 @@ pub fn reveal_actual_level(
75
75
src : & mut LintLevelSource ,
76
76
sess : & Session ,
77
77
lint : LintId ,
78
- probe_for_lint_level : impl FnOnce ( LintId ) -> ( Option < Level > , LintLevelSource ) ,
78
+ probe_for_lint_level : impl Fn ( LintId ) -> ( Option < Level > , LintLevelSource ) ,
79
79
) -> Level {
80
80
// If `level` is none then we actually assume the default level for this lint.
81
81
let mut level = level. unwrap_or_else ( || lint. lint . default_level ( sess. edition ( ) ) ) ;
@@ -90,8 +90,20 @@ pub fn reveal_actual_level(
90
90
// future compatibility warning.
91
91
if level == Level :: Warn && lint != LintId :: of ( FORBIDDEN_LINT_GROUPS ) {
92
92
let ( warnings_level, warnings_src) = probe_for_lint_level ( LintId :: of ( builtin:: WARNINGS ) ) ;
93
- if let Some ( configured_warning_level) = warnings_level {
94
- if configured_warning_level != Level :: Warn {
93
+ if let Some ( configured_warning_level) = warnings_level
94
+ && configured_warning_level != Level :: Warn
95
+ {
96
+ if matches ! ( warnings_src, LintLevelSource :: CommandLine ( ..) )
97
+ && lint != LintId :: of ( builtin:: WARNINGS )
98
+ && let ( Some ( lint_level) , lint_src) = probe_for_lint_level ( lint)
99
+ && matches ! ( lint_src, LintLevelSource :: CommandLine ( ..) )
100
+ {
101
+ // We have a command-line `-Awarnings` *and* a command-line e.g. `-Wspecific-lint`.
102
+ // Let's have the `specific-lint`'s command-line level override the command-line
103
+ // `warnings` level.
104
+ level = lint_level;
105
+ * src = lint_src;
106
+ } else {
95
107
level = configured_warning_level;
96
108
* src = warnings_src;
97
109
}
0 commit comments