@@ -334,9 +334,16 @@ impl LintStore {
334334 }
335335 }
336336
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) {
340347 CheckLintNameResult :: Ok ( _) => None ,
341348 CheckLintNameResult :: Warning ( ref msg, _) => Some ( sess. struct_warn ( msg) ) ,
342349 CheckLintNameResult :: NoLint ( suggestion) => {
@@ -1018,3 +1025,10 @@ impl<'tcx> LayoutOf for LateContext<'tcx> {
10181025 self . tcx . layout_of ( self . param_env . and ( ty) )
10191026 }
10201027}
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