/// match foo {
/// Bar => bar(),
/// Quz => quz(),
-/// Baz => bar(), // <= oups
+/// Baz => bar(), // <= oops
/// }
/// ```
declare_lint! {
///
/// **Why is this bad?** The implementation of these traits must agree (for example for use with
/// `HashMap`) so it’s probably a bad idea to use a default-generated `Hash` implementation with
-/// an explicitely defined `PartialEq`. In particular, the following must hold for any type:
+/// an explicitly defined `PartialEq`. In particular, the following must hold for any type:
///
/// ```rust
/// k1 == k2 ⇒ hash(k1) == hash(k2)
"finds blocks where an item comes after a statement"
}
-pub struct ItemsAfterStatemets;
+pub struct ItemsAfterStatements;
-impl LintPass for ItemsAfterStatemets {
+impl LintPass for ItemsAfterStatements {
fn get_lints(&self) -> LintArray {
lint_array!(ITEMS_AFTER_STATEMENTS)
}
}
-impl EarlyLintPass for ItemsAfterStatemets {
+impl EarlyLintPass for ItemsAfterStatements {
fn check_block(&mut self, cx: &EarlyContext, item: &Block) {
if in_macro(cx, item.span) {
return;
}
Err((err, span)) => {
reg.sess.struct_span_err(span, err)
- .span_note(span, "Clippy will use defaulf configuration")
+ .span_note(span, "Clippy will use default configuration")
.emit();
utils::conf::Conf::default()
}
reg.register_early_lint_pass(box precedence::Precedence);
reg.register_late_lint_pass(box eta_reduction::EtaPass);
reg.register_late_lint_pass(box identity_op::IdentityOp);
- reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatemets);
+ reg.register_early_lint_pass(box items_after_statements::ItemsAfterStatements);
reg.register_late_lint_pass(box mut_mut::MutMut);
reg.register_late_lint_pass(box mut_reference::UnnecessaryMutPassed);
reg.register_late_lint_pass(box len_zero::LenZero);
let arg_name = sp_ident.node.to_string();
if arg_name.starts_with('_') {
- if let Some(correspondance) = registered_names.get(&arg_name[1..]) {
+ if let Some(correspondence) = registered_names.get(&arg_name[1..]) {
span_lint(cx,
DUPLICATE_UNDERSCORE_ARGUMENT,
- *correspondance,
+ *correspondence,
&format!("`{}` already exists, having another argument having almost the same \
name makes code comprehension and documentation more difficult",
arg_name[1..].to_owned()));;
span_lint_and_then(cx,
BOOL_COMPARISON,
e.span,
- "equality checks against true are unnecesary",
+ "equality checks against true are unnecessary",
|db| {
db.span_suggestion(e.span, "try simplifying it as shown:", hint);
});
span_lint_and_then(cx,
BOOL_COMPARISON,
e.span,
- "equality checks against true are unnecesary",
+ "equality checks against true are unnecessary",
|db| {
db.span_suggestion(e.span, "try simplifying it as shown:", hint);
});
pub struct SpanlessEq<'a, 'tcx: 'a> {
/// Context used to evaluate constant expressions.
cx: &'a LateContext<'a, 'tcx>,
- /// If is true, never consider as equal expressions containing fonction calls.
+ /// If is true, never consider as equal expressions containing function calls.
ignore_fn: bool,
}
fn main() {
let x = true;
if x == true { "yes" } else { "no" };
- //~^ ERROR equality checks against true are unnecesary
+ //~^ ERROR equality checks against true are unnecessary
//~| HELP try simplifying it as shown:
//~| SUGGESTION if x { "yes" } else { "no" };
if x == false { "yes" } else { "no" };
//~| HELP try simplifying it as shown:
//~| SUGGESTION if !x { "yes" } else { "no" };
if true == x { "yes" } else { "no" };
- //~^ ERROR equality checks against true are unnecesary
+ //~^ ERROR equality checks against true are unnecessary
//~| HELP try simplifying it as shown:
//~| SUGGESTION if x { "yes" } else { "no" };
if false == x { "yes" } else { "no" };