X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Flint%2Fmod.rs;h=0cc2c356a1551880a103a35e56fb940c9d39d59f;hb=433e546af9503f712089debee665671094f79275;hp=d84102ff3c5d8caf07a6b37895cf9b397b210ce7;hpb=43516981cb67fc66c2323a7b519db95b68be8217;p=rust.git diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index d84102ff3c5..0cc2c356a15 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -39,7 +39,7 @@ use syntax::source_map::{MultiSpan, ExpnKind, DesugaringKind}; use syntax::early_buffered_lints::BufferedEarlyLintId; use syntax::edition::Edition; -use syntax::symbol::{Symbol, sym}; +use syntax::symbol::Symbol; use syntax_pos::hygiene::MacroKind; use syntax_pos::Span; @@ -47,6 +47,8 @@ check_crate, check_ast_crate, late_lint_mod, CheckLintNameResult, BufferedEarlyLint,}; +pub use rustc_session::lint::Level; + /// Specification of a single lint. #[derive(Copy, Clone, Debug)] pub struct Lint { @@ -542,46 +544,6 @@ pub fn to_string(&self) -> String { } } -/// Setting for how to handle a lint. -#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash, HashStable)] -pub enum Level { - Allow, Warn, Deny, Forbid, -} - -impl Level { - /// Converts a level to a lower-case string. - pub fn as_str(self) -> &'static str { - match self { - Allow => "allow", - Warn => "warn", - Deny => "deny", - Forbid => "forbid", - } - } - - /// Converts a lower-case string to a level. - pub fn from_str(x: &str) -> Option { - match x { - "allow" => Some(Allow), - "warn" => Some(Warn), - "deny" => Some(Deny), - "forbid" => Some(Forbid), - _ => None, - } - } - - /// Converts a symbol to a level. - pub fn from_symbol(x: Symbol) -> Option { - match x { - sym::allow => Some(Allow), - sym::warn => Some(Warn), - sym::deny => Some(Deny), - sym::forbid => Some(Forbid), - _ => None, - } - } -} - /// How a lint level was set. #[derive(Clone, Copy, PartialEq, Eq, HashStable)] pub enum LintSource {