use rustc_data_structures::sync::{self, Lrc};
-use crate::errors::{DiagnosticBuilder, DiagnosticId};
use crate::hir::def_id::{CrateNum, LOCAL_CRATE};
use crate::hir::intravisit;
use crate::hir;
use crate::lint::builtin::{BuiltinLintDiagnostics, DUPLICATE_MATCHER_BINDING_NAME};
use crate::lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT};
use crate::session::{Session, DiagnosticMessageId};
+use crate::ty::TyCtxt;
+use crate::ty::query::Providers;
+use crate::util::nodemap::NodeMap;
+use errors::{DiagnosticBuilder, DiagnosticId};
use std::{hash, ptr};
use syntax::ast;
use syntax::source_map::{MultiSpan, ExpnFormat};
use syntax::edition::Edition;
use syntax::symbol::Symbol;
use syntax_pos::Span;
-use crate::ty::TyCtxt;
-use crate::ty::query::Providers;
-use crate::util::nodemap::NodeMap;
pub use crate::lint::context::{LateContext, EarlyContext, LintContext, LintStore,
check_crate, check_ast_crate, CheckLintNameResult,
/// `default_level`.
pub edition_lint_opts: Option<(Edition, Level)>,
- /// Whether this lint is reported even inside expansions of external macros
+ /// `true` if this lint is reported even inside expansions of external macros.
pub report_in_external_macro: bool,
}
}
}
- /// Get the lint's name, with ASCII letters converted to lowercase.
+ /// Gets the lint's name, with ASCII letters converted to lowercase.
pub fn name_lower(&self) -> String {
self.name.to_ascii_lowercase()
}
}
}
-/// Declare a static item of type `&'static Lint`.
+/// Declares a static item of type `&'static Lint`.
#[macro_export]
macro_rules! declare_lint {
($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
);
}
-/// Declare a static `LintArray` and return it as an expression.
+/// Declares a static `LintArray` and return it as an expression.
#[macro_export]
macro_rules! lint_array {
($( $lint:expr ),* ,) => { lint_array!( $($lint),* ) };
pub trait LintPass {
fn name(&self) -> &'static str;
- /// Get descriptions of the lints this `LintPass` object can emit.
+ /// Gets descriptions of the lints this `LintPass` object can emit.
///
/// N.B., there is no enforcement that the object only emits lints it registered.
/// And some `rustc` internal `LintPass`es register lints to be emitted by other
}
impl LintId {
- /// Get the `LintId` for a `Lint`.
+ /// Gets the `LintId` for a `Lint`.
pub fn of(lint: &'static Lint) -> LintId {
LintId {
lint,
self.lint.name
}
- /// Get the name of the lint.
+ /// Gets the name of the lint.
pub fn to_string(&self) -> String {
self.lint.name_lower()
}
});
impl Level {
- /// Convert a level to a lower-case string.
+ /// Converts a level to a lower-case string.
pub fn as_str(self) -> &'static str {
match self {
Allow => "allow",
}
}
- /// Convert a lower-case string to a level.
+ /// Converts a lower-case string to a level.
pub fn from_str(x: &str) -> Option<Level> {
match x {
"allow" => Some(Allow),