use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
+use if_chain::if_chain;
use rustc::hir;
use rustc::hir::def::Def;
-use utils::{match_def_path, span_lint_and_sugg};
+use crate::utils::{match_def_path, span_lint_and_sugg};
/// **What it does:** Checks for usage of `ATOMIC_X_INIT`, `ONCE_INIT`, and
/// `uX/iX::MIN/MAX`.
/// ```rust
/// static FOO: AtomicIsize = AtomicIsize::new(0);
/// ```
-declare_lint! {
+declare_clippy_lint! {
pub REPLACE_CONSTS,
- Allow,
+ pedantic,
"Lint usages of standard library `const`s that could be replaced by `const fn`s"
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ReplaceConsts {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
if_chain! {
- if let hir::ExprPath(ref qp) = expr.node;
+ if let hir::ExprKind::Path(ref qp) = expr.node;
if let Def::Const(def_id) = cx.tables.qpath_def(qp, expr.hir_id);
then {
for &(const_path, repl_snip) in REPLACEMENTS {