Skip to content

Commit

Permalink
Correct maud::DOCTYPE_HTML to maud::DOCTYPE
Browse files Browse the repository at this point in the history
Closes #69 (nice)
  • Loading branch information
lambda-fairy committed Feb 6, 2017
1 parent f858430 commit aa2c586
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ use super::util::match_def_path;
use syntax::ast::LitKind;

declare_lint! {
pub MAUD_DOCTYPE_HTML,
pub MAUD_DOCTYPE,
Warn,
"suggest using the maud::DOCTYPE_HTML constant"
"suggest using the maud::DOCTYPE constant"
}

pub struct DoctypeHtml;
pub struct Doctype;

impl LintPass for DoctypeHtml {
impl LintPass for Doctype {
fn get_lints(&self) -> LintArray {
lint_array![MAUD_DOCTYPE_HTML]
lint_array![MAUD_DOCTYPE]
}
}

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DoctypeHtml {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Doctype {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
if_chain! {
// It's a function call...
Expand All @@ -33,8 +33,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DoctypeHtml {
let def_id = cx.tables.qpath_def(qpath, path_expr.id).def_id();
if match_def_path(cx, def_id, &["maud", "PreEscaped", "{{constructor}}"]);
then {
cx.struct_span_lint(MAUD_DOCTYPE_HTML, expr.span,
"use `maud::DOCTYPE_HTML` instead").emit();
cx.struct_span_lint(MAUD_DOCTYPE, expr.span,
"use `maud::DOCTYPE` instead").emit();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions maud_macros/src/lints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ use rustc_plugin::Registry;
#[macro_use]
mod util;

pub mod doctype_html;
mod doctype;

pub fn register_lints(reg: &mut Registry) {
reg.register_late_lint_pass(Box::new(doctype_html::DoctypeHtml));
reg.register_late_lint_pass(Box::new(doctype::Doctype));

reg.register_lint_group("maud", vec![
doctype_html::MAUD_DOCTYPE_HTML,
doctype::MAUD_DOCTYPE,
]);
}

0 comments on commit aa2c586

Please sign in to comment.