fn diagnostic_severity(
    config: &DiagnosticsMapConfig,
    level: flycheck::DiagnosticLevel,
    code: Option<flycheck::DiagnosticCode>,
) -> Option<lsp_types::DiagnosticSeverity> {
    let res = match level {
        DiagnosticLevel::Ice => lsp_types::DiagnosticSeverity::ERROR,
        DiagnosticLevel::Error => lsp_types::DiagnosticSeverity::ERROR,
        DiagnosticLevel::Warning => match &code {
            // HACK: special case for `warnings` rustc lint.
            Some(code)
                if config.warnings_as_hint.iter().any(|lint| {
                    lint == "warnings" || ide_db::helpers::lint_eq_or_in_group(&code.code, lint)
                }) =>
            {
                lsp_types::DiagnosticSeverity::HINT
            }
            // HACK: special case for `warnings` rustc lint.
            Some(code)
                if config.warnings_as_info.iter().any(|lint| {
                    lint == "warnings" || ide_db::helpers::lint_eq_or_in_group(&code.code, lint)
                }) =>
            {
                lsp_types::DiagnosticSeverity::INFORMATION
            }
            _ => lsp_types::DiagnosticSeverity::WARNING,
        },
        DiagnosticLevel::Note => lsp_types::DiagnosticSeverity::INFORMATION,
        DiagnosticLevel::Help => lsp_types::DiagnosticSeverity::HINT,
        _ => return None,
    };
    Some(res)
}
/// Determines the LSP severity from a diagnostic
Determines the LSP severity from a diagnostic
Determines the LSP severity from a diagnostic
fn diagnostic_severity(
    config: &DiagnosticsMapConfig,
    level: flycheck::DiagnosticLevel,
    code: Option<flycheck::DiagnosticCode>,
) -> Option<lsp_types::DiagnosticSeverity> {
    let res = match level {
        DiagnosticLevel::Ice => lsp_types::DiagnosticSeverity::ERROR,
        DiagnosticLevel::Error => lsp_types::DiagnosticSeverity::ERROR,
        DiagnosticLevel::Warning => match &code {
            // HACK: special case for `warnings` rustc lint.
            Some(code)
                if config.warnings_as_hint.iter().any(|lint| {
                    lint == "warnings" || ide_db::helpers::lint_eq_or_in_group(&code.code, lint)
                }) =>
            {
                lsp_types::DiagnosticSeverity::HINT
            }
            // HACK: special case for `warnings` rustc lint.
            Some(code)
                if config.warnings_as_info.iter().any(|lint| {
                    lint == "warnings" || ide_db::helpers::lint_eq_or_in_group(&code.code, lint)
                }) =>
            {
                lsp_types::DiagnosticSeverity::INFORMATION
            }
            _ => lsp_types::DiagnosticSeverity::WARNING,
        },
        DiagnosticLevel::Note => lsp_types::DiagnosticSeverity::INFORMATION,
        DiagnosticLevel::Help => lsp_types::DiagnosticSeverity::HINT,
        _ => return None,
    };
    Some(res)
}
fn diagnostic_severity ( config : & DiagnosticsMapConfig , level : flycheck :: DiagnosticLevel , code : Option < flycheck :: DiagnosticCode > , ) -> Option < lsp_types :: DiagnosticSeverity > { let res = match level { DiagnosticLevel :: Ice => lsp_types :: DiagnosticSeverity :: ERROR , DiagnosticLevel :: Error => lsp_types :: DiagnosticSeverity :: ERROR , DiagnosticLevel :: Warning => match & code { // HACK: special case for `warnings` rustc lint. Some ( code ) if config . warnings_as_hint . iter ( ) . any ( | lint | { lint == " " || ide_db :: helpers :: lint_eq_or_in_group ( & code . code , lint ) } ) => { lsp_types :: DiagnosticSeverity :: HINT } // HACK: special case for `warnings` rustc lint. Some ( code ) if config . warnings_as_info . iter ( ) . any ( | lint | { lint == " " || ide_db :: helpers :: lint_eq_or_in_group ( & code . code , lint ) } ) => { lsp_types :: DiagnosticSeverity :: INFORMATION } _ => lsp_types :: DiagnosticSeverity :: WARNING , } , DiagnosticLevel :: Note => lsp_types :: DiagnosticSeverity :: INFORMATION , DiagnosticLevel :: Help => lsp_types :: DiagnosticSeverity :: HINT , _ => return None , } ; Some ( res ) }
Determines the LSP severity from a diagnostic
Determines the LSP severity from a diagnostic
config
&DiagnosticsMapConfig
level
flycheck::DiagnosticLevel
code
Option<flycheck::DiagnosticCode>
config
&DiagnosticsMapConfig
level
flycheck::DiagnosticLevel
code
Option<flycheck::DiagnosticCode>