@@ -334,9 +334,16 @@ impl LintStore {
334
334
}
335
335
}
336
336
337
- /// Checks the validity of lint names derived from the command line
338
- pub fn check_lint_name_cmdline ( & self , sess : & Session , lint_name : & str , level : Level ) {
339
- let db = match self . check_lint_name ( lint_name, None ) {
337
+ /// Checks the validity of lint names derived from the command line. Returns
338
+ /// true if the lint is valid, false otherwise.
339
+ pub fn check_lint_name_cmdline (
340
+ & self ,
341
+ sess : & Session ,
342
+ lint_name : & str ,
343
+ level : Option < Level > ,
344
+ ) -> bool {
345
+ let ( tool_name, lint_name) = parse_lint_and_tool_name ( lint_name) ;
346
+ let db = match self . check_lint_name ( lint_name, tool_name) {
340
347
CheckLintNameResult :: Ok ( _) => None ,
341
348
CheckLintNameResult :: Warning ( ref msg, _) => Some ( sess. struct_warn ( msg) ) ,
342
349
CheckLintNameResult :: NoLint ( suggestion) => {
@@ -1018,3 +1025,10 @@ impl<'tcx> LayoutOf for LateContext<'tcx> {
1018
1025
self . tcx . layout_of ( self . param_env . and ( ty) )
1019
1026
}
1020
1027
}
1028
+
1029
+ pub fn parse_lint_and_tool_name ( lint_name : & str ) -> ( Option < Symbol > , & str ) {
1030
+ match lint_name. split_once ( "::" ) {
1031
+ Some ( ( tool_name, lint_name) ) => ( Some ( Symbol :: intern ( tool_name) ) , lint_name) ,
1032
+ None => ( None , lint_name) ,
1033
+ }
1034
+ }
0 commit comments