pub fn report_settings(&self) -> report::Settings {
        let mut settings = rustsec::report::Settings {
            ignore: self.advisories.ignore.clone(),
            severity: self.advisories.severity_threshold,
            target_arch: self.target.arch,
            target_os: self.target.os,
            ..Default::default()
        };

        if let Some(source) = &self.packages.source {
            settings.package_scope = Some(source.clone().into());
        }

        if let Some(informational_warnings) = &self.advisories.informational_warnings {
            settings.informational_warnings = informational_warnings.clone();
        } else {
            // Alert for unmaintained packages by default
            settings.informational_warnings = vec![advisory::Informational::Unmaintained];
        }

        // Enable warnings for all informational advisories if they are marked deny.
        // Deny only works on the output if a corresponding advisory is found but only the
        // informational categories listed in informational_warnings are reported.
        // This means that if "Unsound" is missing from informational_warnings then deny unsound
        // will not do anything.
        // To fix this always add the corresponding warning category
        let mut insert_if_not_present = |warning| {
            if !settings.informational_warnings.contains(&warning) {
                settings.informational_warnings.push(warning);
            }
        };

        for deny in &self.output.deny {
            match deny {
                DenyOption::Warnings => {
                    insert_if_not_present(advisory::Informational::Notice);
                    insert_if_not_present(advisory::Informational::Unmaintained);
                    insert_if_not_present(advisory::Informational::Unsound);
                    break;
                }
                DenyOption::Unmaintained => {
                    insert_if_not_present(advisory::Informational::Unmaintained)
                }
                DenyOption::Unsound => insert_if_not_present(advisory::Informational::Unsound),
                DenyOption::Yanked => continue,
            };
        }

        settings
    }
/// Get audit report settings from the configuration
Get audit report settings from the configuration
Get audit report settings from the configuration
pub fn report_settings(&self) -> report::Settings {
        let mut settings = rustsec::report::Settings {
            ignore: self.advisories.ignore.clone(),
            severity: self.advisories.severity_threshold,
            target_arch: self.target.arch,
            target_os: self.target.os,
            ..Default::default()
        };
        if let Some(source) = &self.packages.source {
            settings.package_scope = Some(source.clone().into());
        }
        if let Some(informational_warnings) = &self.advisories.informational_warnings {
            settings.informational_warnings = informational_warnings.clone();
        } else {
            // Alert for unmaintained packages by default
            settings.informational_warnings = vec![advisory::Informational::Unmaintained];
        }
        // Enable warnings for all informational advisories if they are marked deny.
        // Deny only works on the output if a corresponding advisory is found but only the
        // informational categories listed in informational_warnings are reported.
        // This means that if "Unsound" is missing from informational_warnings then deny unsound
        // will not do anything.
        // To fix this always add the corresponding warning category
        let mut insert_if_not_present = |warning| {
            if !settings.informational_warnings.contains(&warning) {
                settings.informational_warnings.push(warning);
            }
        };
        for deny in &self.output.deny {
            match deny {
                DenyOption::Warnings => {
                    insert_if_not_present(advisory::Informational::Notice);
                    insert_if_not_present(advisory::Informational::Unmaintained);
                    insert_if_not_present(advisory::Informational::Unsound);
                    break;
                }
                DenyOption::Unmaintained => {
                    insert_if_not_present(advisory::Informational::Unmaintained)
                }
                DenyOption::Unsound => insert_if_not_present(advisory::Informational::Unsound),
                DenyOption::Yanked => continue,
            };
        }
        settings
    }
pub fn report_settings ( & self ) -> report :: Settings { let mut settings = rustsec :: report :: Settings { ignore : self . advisories . ignore . clone ( ) , severity : self . advisories . severity_threshold , target_arch : self . target . arch , target_os : self . target . os , .. Default :: default ( ) } ; if let Some ( source ) = & self . packages . source { settings . package_scope = Some ( source . clone ( ) . into ( ) ) ; } if let Some ( informational_warnings ) = & self . advisories . informational_warnings { settings . informational_warnings = informational_warnings . clone ( ) ; } else { // Alert for unmaintained packages by default settings . informational_warnings = vec ! [ advisory Informational Unmaintained ] ; } // Enable warnings for all informational advisories if they are marked deny. // Deny only works on the output if a corresponding advisory is found but only the // informational categories listed in informational_warnings are reported. // This means that if "Unsound" is missing from informational_warnings then deny unsound // will not do anything. // To fix this always add the corresponding warning category let mut insert_if_not_present = | warning | { if ! settings . informational_warnings . contains ( & warning ) { settings . informational_warnings . push ( warning ) ; } } ; for deny in & self . output . deny { match deny { DenyOption :: Warnings => { insert_if_not_present ( advisory :: Informational :: Notice ) ; insert_if_not_present ( advisory :: Informational :: Unmaintained ) ; insert_if_not_present ( advisory :: Informational :: Unsound ) ; break ; } DenyOption :: Unmaintained => { insert_if_not_present ( advisory :: Informational :: Unmaintained ) } DenyOption :: Unsound => insert_if_not_present ( advisory :: Informational :: Unsound ) , DenyOption :: Yanked => continue , } ; } settings }
Get audit report settings from the configuration
Get audit report settings from the configuration
&self
&self