Function rustdoc::lint::init_lints

source ·
pub(crate) fn init_lints<F>(
    allowed_lints: Vec<String>,
    lint_opts: Vec<(String, Level)>,
    filter_call: F
) -> (Vec<(String, Level)>, FxHashMap<LintId, Level>)
where F: Fn(&Lint) -> Option<(String, Level)>,
Expand description

This function is used to setup the lint initialization. By default, in rustdoc, everything is “allowed”. Depending if we run in test mode or not, we want some of them to be at their default level. For example, the “INVALID_CODEBLOCK_ATTRIBUTES” lint is activated in both modes.

A little detail easy to forget is that there is a way to set the lint level for all lints through the “WARNINGS” lint. To prevent this to happen, we set it back to its “normal” level inside this function.

It returns a tuple containing:

  • Vector of tuples of lints’ name and their associated “max” level
  • HashMap of lint id with their associated “max” level