From bcd95aec1ce4f2a328a2b1d4b2a1e44d36e02436 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 12 Aug 2015 10:46:49 +0200 Subject: [PATCH] all: make style of lint messages consistent * start first sentence lowercased * use backticks to delimit code snippets * use "this is wrong. Consider doing X." consistently --- src/approx_const.rs | 2 +- src/attrs.rs | 2 +- src/bit_mask.rs | 16 ++++++++-------- src/collapsible_if.rs | 2 +- src/eta_reduction.rs | 2 +- src/identity_op.rs | 2 +- src/len_zero.rs | 10 +++++----- src/misc.rs | 20 ++++++++++---------- src/mut_mut.rs | 8 ++++---- src/needless_bool.rs | 4 ++-- src/ptr_arg.rs | 10 +++++----- src/returns.rs | 2 +- src/strings.rs | 4 ++-- src/types.rs | 8 +++----- src/unicode.rs | 2 +- tests/compile-fail/attrs.rs | 2 +- tests/compile-fail/box_vec.rs | 2 +- tests/compile-fail/collapsible_if.rs | 4 ++-- tests/compile-fail/eta.rs | 8 ++++---- tests/compile-fail/len_zero.rs | 12 ++++++------ tests/compile-fail/match_if_let.rs | 8 ++++---- tests/compile-fail/modulo_one.rs | 2 +- tests/compile-fail/ptr_arg.rs | 2 +- tests/compile-fail/unicode.rs | 6 +++--- 24 files changed, 69 insertions(+), 71 deletions(-) mode change 100644 => 100755 tests/compile-fail/eta.rs mode change 100644 => 100755 tests/compile-fail/modulo_one.rs diff --git a/src/approx_const.rs b/src/approx_const.rs index 3ae579a74b9..594348bf93f 100644 --- a/src/approx_const.rs +++ b/src/approx_const.rs @@ -53,7 +53,7 @@ fn check_known_consts(cx: &Context, span: Span, str: &str, module: &str) { for &(constant, name) in KNOWN_CONSTS { if within_epsilon(constant, value) { span_lint(cx, APPROX_CONSTANT, span, &format!( - "Approximate value of {}::{} found, consider using it directly.", module, &name)); + "approximate value of `{}::{}` found. Consider using it directly.", module, &name)); } } } diff --git a/src/attrs.rs b/src/attrs.rs index 6d73f1de964..789a992e3a5 100644 --- a/src/attrs.rs +++ b/src/attrs.rs @@ -101,7 +101,7 @@ fn check_attrs(cx: &Context, info: Option<&ExpnInfo>, ident: &Ident, if let MetaWord(ref always) = values[0].node { if always != &"always" { continue; } span_lint(cx, INLINE_ALWAYS, attr.span, &format!( - "You have declared #[inline(always)] on {}. This \ + "you have declared `#[inline(always)]` on `{}`. This \ is usually a bad idea. Are you sure?", ident.name.as_str())); } diff --git a/src/bit_mask.rs b/src/bit_mask.rs index ad6facfb199..b5f088c23ef 100644 --- a/src/bit_mask.rs +++ b/src/bit_mask.rs @@ -97,7 +97,7 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, BiBitAnd => if mask_value & cmp_value != mask_value { if cmp_value != 0 { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ & {} can never be equal to {}", + "incompatible bit mask: `_ & {}` can never be equal to `{}`", mask_value, cmp_value)); } } else { @@ -108,7 +108,7 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, }, BiBitOr => if mask_value | cmp_value != cmp_value { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ | {} can never be equal to {}", + "incompatible bit mask: `_ | {}` can never be equal to `{}`", mask_value, cmp_value)); }, _ => () @@ -116,7 +116,7 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, BiLt | BiGe => match bit_op { BiBitAnd => if mask_value < cmp_value { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ & {} will always be lower than {}", + "incompatible bit mask: `_ & {}` will always be lower than `{}`", mask_value, cmp_value)); } else { if mask_value == 0 { @@ -126,12 +126,12 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, }, BiBitOr => if mask_value >= cmp_value { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ | {} will never be lower than {}", + "incompatible bit mask: `_ | {}` will never be lower than `{}`", mask_value, cmp_value)); } else { if mask_value < cmp_value { span_lint(cx, INEFFECTIVE_BIT_MASK, *span, &format!( - "ineffective bit mask: x | {} compared to {} is the same as x compared directly", + "ineffective bit mask: `x | {}` compared to `{}` is the same as x compared directly", mask_value, cmp_value)); } }, @@ -140,7 +140,7 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, BiLe | BiGt => match bit_op { BiBitAnd => if mask_value <= cmp_value { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ & {} will never be higher than {}", + "incompatible bit mask: `_ & {}` will never be higher than `{}`", mask_value, cmp_value)); } else { if mask_value == 0 { @@ -150,12 +150,12 @@ fn check_bit_mask(cx: &Context, bit_op: BinOp_, cmp_op: BinOp_, }, BiBitOr => if mask_value > cmp_value { span_lint(cx, BAD_BIT_MASK, *span, &format!( - "incompatible bit mask: _ | {} will always be higher than {}", + "incompatible bit mask: `_ | {}` will always be higher than `{}`", mask_value, cmp_value)); } else { if mask_value < cmp_value { span_lint(cx, INEFFECTIVE_BIT_MASK, *span, &format!( - "ineffective bit mask: x | {} compared to {} is the same as x compared directly", + "ineffective bit mask: `x | {}` compared to `{}` is the same as x compared directly", mask_value, cmp_value)); } }, diff --git a/src/collapsible_if.rs b/src/collapsible_if.rs index eae3222945c..f1c82f3eef8 100644 --- a/src/collapsible_if.rs +++ b/src/collapsible_if.rs @@ -48,7 +48,7 @@ fn check_expr_expd(cx: &Context, e: &Expr, info: Option<&ExpnInfo>) { if let Some(&Expr{ node: ExprIf(ref check_inner, _, None), ..}) = single_stmt_of_block(then) { span_lint(cx, COLLAPSIBLE_IF, e.span, &format!( - "This if statement can be collapsed. Try: if {} && {}\n{:?}", + "this if statement can be collapsed. Try: `if {} && {}`\n{:?}", check_to_string(check), check_to_string(check_inner), e)); } } diff --git a/src/eta_reduction.rs b/src/eta_reduction.rs index 6948c1b22ab..00c5a523981 100644 --- a/src/eta_reduction.rs +++ b/src/eta_reduction.rs @@ -51,7 +51,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { } } span_lint(cx, REDUNDANT_CLOSURE, expr.span, - &format!("Redundant closure found, consider using `{}` in its place", + &format!("redundant closure found. Consider using `{}` in its place.", expr_to_string(caller))[..]) } } diff --git a/src/identity_op.rs b/src/identity_op.rs index 56d01c52b1d..e043ac63026 100644 --- a/src/identity_op.rs +++ b/src/identity_op.rs @@ -49,7 +49,7 @@ fn check_expr(&mut self, cx: &Context, e: &Expr) { fn check(cx: &Context, e: &Expr, m: i8, span: Span, arg: Span) { if have_lit(cx, e, m) { span_lint(cx, IDENTITY_OP, span, &format!( - "The operation is ineffective. Consider reducing it to '{}'", + "the operation is ineffective. Consider reducing it to `{}`.", snippet(cx, arg, ".."))); } } diff --git a/src/len_zero.rs b/src/len_zero.rs index 8aa4c626760..dea713180f5 100644 --- a/src/len_zero.rs +++ b/src/len_zero.rs @@ -58,8 +58,8 @@ fn is_named_self(item: &TraitItem, name: &str) -> bool { for i in trait_items { if is_named_self(i, "len") { span_lint(cx, LEN_WITHOUT_IS_EMPTY, i.span, - &format!("Trait '{}' has a '.len(_: &Self)' method, but no \ - '.is_empty(_: &Self)' method. Consider adding one.", + &format!("trait `{}` has a `.len(_: &Self)` method, but no \ + `.is_empty(_: &Self)` method. Consider adding one.", item.ident.name)); } }; @@ -78,8 +78,8 @@ fn is_named_self(item: &ImplItem, name: &str) -> bool { let s = i.span; span_lint(cx, LEN_WITHOUT_IS_EMPTY, Span{ lo: s.lo, hi: s.lo, expn_id: s.expn_id }, - &format!("Item '{}' has a '.len(_: &Self)' method, but no \ - '.is_empty(_: &Self)' method. Consider adding one.", + &format!("item `{}` has a `.len(_: &Self)` method, but no \ + `.is_empty(_: &Self)` method. Consider adding one.", item.ident.name)); return; } @@ -108,7 +108,7 @@ fn check_len_zero(cx: &Context, span: Span, method: &SpannedIdent, if method.node.name == "len" && args.len() == 1 && has_is_empty(cx, &*args[0]) { span_lint(cx, LEN_ZERO, span, &format!( - "Consider replacing the len comparison with '{}_.is_empty()'", + "consider replacing the len comparison with `{}_.is_empty()`", empty)) } } diff --git a/src/misc.rs b/src/misc.rs index 934e8a7fb77..fa1847aad9a 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -43,10 +43,10 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { format!("{{ {} }}", body_code) }; span_help_and_lint(cx, SINGLE_MATCH, expr.span, - "You seem to be trying to use match for \ + "you seem to be trying to use match for \ destructuring a single pattern. Did you mean to \ use `if let`?", - &*format!("Try\nif let {} = {} {}", + &*format!("try\nif let {} = {} {}", snippet(cx, arms[0].pats[0].span, ".."), snippet(cx, ex.span, ".."), suggestion) @@ -74,7 +74,7 @@ fn check_expr(&mut self, cx: &Context, expr: &ast::Expr) { ast::ExprMethodCall(ref method, _, ref args) if method.node.name == "to_string" && is_str(cx, &*args[0]) => { - span_lint(cx, STR_TO_STRING, expr.span, "str.to_owned() is faster"); + span_lint(cx, STR_TO_STRING, expr.span, "`str.to_owned()` is faster"); }, _ => () } @@ -105,7 +105,7 @@ fn check_fn(&mut self, cx: &Context, _: FnKind, decl: &FnDecl, _: &Block, _: Spa span_lint(cx, TOPLEVEL_REF_ARG, arg.pat.span, - "`ref` directly on a function argument is ignored. Have you considered using a reference type instead?" + "`ref` directly on a function argument is ignored. Consider using a reference type instead." ); } } @@ -139,7 +139,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { fn check_nan(cx: &Context, path: &Path, span: Span) { path.segments.last().map(|seg| if seg.identifier.name == "NAN" { span_lint(cx, CMP_NAN, span, - "Doomed comparison with NAN, use std::{f32,f64}::is_nan instead"); + "doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead"); }); } @@ -159,7 +159,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { let op = cmp.node; if (op == BiEq || op == BiNe) && (is_float(cx, left) || is_float(cx, right)) { span_lint(cx, FLOAT_CMP, expr.span, &format!( - "{}-Comparison of f32 or f64 detected. You may want to change this to 'abs({} - {}) < epsilon' for some suitable value of epsilon", + "{}-comparison of f32 or f64 detected. Consider changing this to `abs({} - {}) < epsilon` for some suitable value of epsilon.", binop_to_string(op), snippet(cx, left.span, ".."), snippet(cx, right.span, ".."))); } @@ -190,7 +190,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { if let ExprBinary(Spanned { node: op, ..}, ref left, ref right) = expr.node { if is_bit_op(op) && (is_arith_expr(left) || is_arith_expr(right)) { span_lint(cx, PRECEDENCE, expr.span, - "Operator precedence can trip the unwary. Consider adding parenthesis to the subexpression."); + "operator precedence can trip the unwary. Consider adding parenthesis to the subexpression."); } } } @@ -246,7 +246,7 @@ fn check_to_owned(cx: &Context, expr: &Expr, other_span: Span) { name == "to_owned" && is_str_arg(cx, args) { span_lint(cx, CMP_OWNED, expr.span, &format!( "this creates an owned instance just for comparison. \ - Consider using {}.as_slice() to compare without allocation", + Consider using `{}.as_slice()` to compare without allocation.", snippet(cx, other_span, ".."))) } }, @@ -256,7 +256,7 @@ fn check_to_owned(cx: &Context, expr: &Expr, other_span: Span) { match_path(path, &["String", "from"]) { span_lint(cx, CMP_OWNED, expr.span, &format!( "this creates an owned instance just for comparison. \ - Consider using {}.as_slice() to compare without allocation", + Consider using `{}.as_slice()` to compare without allocation.", snippet(cx, other_span, ".."))) } } @@ -284,7 +284,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { if let ExprBinary(ref cmp, _, ref right) = expr.node { if let &Spanned {node: BinOp_::BiRem, ..} = cmp { if is_lit_one(right) { - cx.span_lint(MODULO_ONE, expr.span, "Any number modulo 1 will be 0"); + cx.span_lint(MODULO_ONE, expr.span, "any number modulo 1 will be 0"); } } } diff --git a/src/mut_mut.rs b/src/mut_mut.rs index 16ea422f77f..469a14a9452 100644 --- a/src/mut_mut.rs +++ b/src/mut_mut.rs @@ -23,7 +23,7 @@ fn check_expr(&mut self, cx: &Context, expr: &Expr) { fn check_ty(&mut self, cx: &Context, ty: &Ty) { unwrap_mut(ty).and_then(unwrap_mut).map_or((), |_| span_lint(cx, MUT_MUT, - ty.span, "Generally you want to avoid &mut &mut _ if possible.")) + ty.span, "generally you want to avoid `&mut &mut _` if possible")) } } @@ -40,13 +40,13 @@ fn unwrap_addr(expr : &Expr) -> Option<&Expr> { unwrap_addr(expr).map_or((), |e| { unwrap_addr(e).map(|_| { span_lint(cx, MUT_MUT, expr.span, - "Generally you want to avoid &mut &mut _ if possible.") + "generally you want to avoid `&mut &mut _` if possible") }).unwrap_or_else(|| { if let TyRef(_, TypeAndMut{ty: _, mutbl: MutMutable}) = cx.tcx.expr_ty(e).sty { span_lint(cx, MUT_MUT, expr.span, - "This expression mutably borrows a mutable reference. \ - Consider reborrowing") + "this expression mutably borrows a mutable reference. \ + Consider reborrowing.") } }) }) diff --git a/src/needless_bool.rs b/src/needless_bool.rs index 3296bdeca87..fcbc287e30f 100644 --- a/src/needless_bool.rs +++ b/src/needless_bool.rs @@ -34,10 +34,10 @@ fn check_expr(&mut self, cx: &Context, e: &Expr) { "your if-then-else expression will always return true"); }, (Option::Some(true), Option::Some(false)) => { span_lint(cx, NEEDLESS_BOOL, e.span, - "you can reduce your if-statement to its predicate"); }, + "you can reduce your if statement to its predicate"); }, (Option::Some(false), Option::Some(true)) => { span_lint(cx, NEEDLESS_BOOL, e.span, - "you can reduce your if-statement to '!' + your predicate"); }, + "you can reduce your if statement to `!` + your predicate"); }, (Option::Some(false), Option::Some(false)) => { span_lint(cx, NEEDLESS_BOOL, e.span, "your if-then-else expression will always return false"); }, diff --git a/src/ptr_arg.rs b/src/ptr_arg.rs index 939277fe66c..ed37c112040 100644 --- a/src/ptr_arg.rs +++ b/src/ptr_arg.rs @@ -60,10 +60,10 @@ fn check_ptr_subtype(cx: &Context, span: Span, ty: &Ty) { match_ty_unwrap(ty, &["Vec"]).map_or_else(|| match_ty_unwrap(ty, &["String"]).map_or((), |_| { span_lint(cx, PTR_ARG, span, - "Writing '&String' instead of '&str' involves a new Object \ - where a slices will do. Consider changing the type to &str") + "writing `&String` instead of `&str` involves a new object \ + where a slice will do. Consider changing the type to `&str`.") }), |_| span_lint(cx, PTR_ARG, span, - "Writing '&Vec<_>' instead of \ - '&[_]' involves one more reference and cannot be used with \ - non-vec-based slices. Consider changing the type to &[...]")) + "writing `&Vec<_>` instead of \ + `&[_]` involves one more reference and cannot be used with \ + non-Vec-based slices. Consider changing the type to `&[...]`.")) } diff --git a/src/returns.rs b/src/returns.rs index 5a361d3a7dc..70af37d5181 100644 --- a/src/returns.rs +++ b/src/returns.rs @@ -59,7 +59,7 @@ fn check_final_expr(&mut self, cx: &Context, expr: &Expr) { fn emit_return_lint(&mut self, cx: &Context, spans: (Span, Span)) { span_lint(cx, NEEDLESS_RETURN, spans.0, &format!( - "unneeded return statement. Consider using {} \ + "unneeded return statement. Consider using `{}` \ without the trailing semicolon", snippet(cx, spans.1, ".."))) } diff --git a/src/strings.rs b/src/strings.rs index b6bc7654e47..97016f36268 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -29,8 +29,8 @@ fn check_expr(&mut self, cx: &Context, e: &Expr) { if let &ExprAssign(ref target, ref src) = &e.node { if is_string(cx, target) && is_add(src, target) { span_lint(cx, STRING_ADD_ASSIGN, e.span, - "You assign the result of adding something to this string. \ - Consider using `String::push_str(..) instead.") + "you assign the result of adding something to this string. \ + Consider using `String::push_str()` instead.") } } } diff --git a/src/types.rs b/src/types.rs index f6d7749f160..b03829660dc 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,5 +1,3 @@ - - use syntax::ptr::P; use syntax::ast; use syntax::ast::*; @@ -55,8 +53,8 @@ fn check_ty(&mut self, cx: &Context, ty: &ast::Ty) { .and_then(|t| match_ty_unwrap(&**t, &["std", "vec", "Vec"])) .map(|_| { span_help_and_lint(cx, BOX_VEC, ty.span, - "You seem to be trying to use Box>. Did you mean to use Vec?", - "Vec is already on the heap, Box> makes an extra allocation"); + "you seem to be trying to use `Box>`. Did you mean to use `Vec`?", + "`Vec` is already on the heap, `Box>` makes an extra allocation"); }); { // In case stuff gets moved around @@ -71,7 +69,7 @@ fn check_ty(&mut self, cx: &Context, ty: &ast::Ty) { if match_ty_unwrap(ty, &path[..]).is_some() { span_help_and_lint(cx, LINKEDLIST, ty.span, "I see you're using a LinkedList! Perhaps you meant some other data structure?", - "A RingBuf might work."); + "a RingBuf might work"); return; } } diff --git a/src/unicode.rs b/src/unicode.rs index 1854d5be7ff..af48c9b99ad 100644 --- a/src/unicode.rs +++ b/src/unicode.rs @@ -41,6 +41,6 @@ fn lint_zero_width(cx: &Context, span: Span, start: Option) { lo: span.lo + BytePos(index as u32), hi: span.lo + BytePos(index as u32), expn_id: span.expn_id, - }, "Zero-width space detected. Consider using \\u{200B}") + }, "zero-width space detected. Consider using `\\u{200B}`.") }); } diff --git a/tests/compile-fail/attrs.rs b/tests/compile-fail/attrs.rs index 42bb0fca6dc..ca7a0d5c07b 100755 --- a/tests/compile-fail/attrs.rs +++ b/tests/compile-fail/attrs.rs @@ -3,7 +3,7 @@ #![deny(inline_always)] -#[inline(always)] //~ERROR You have declared #[inline(always)] on test_attr_lint. +#[inline(always)] //~ERROR you have declared `#[inline(always)]` on `test_attr_lint`. fn test_attr_lint() { assert!(true) } diff --git a/tests/compile-fail/box_vec.rs b/tests/compile-fail/box_vec.rs index 7d80dd86d22..58e780f190c 100755 --- a/tests/compile-fail/box_vec.rs +++ b/tests/compile-fail/box_vec.rs @@ -3,7 +3,7 @@ #![plugin(clippy)] #![deny(clippy)] -pub fn test(foo: Box>) { //~ ERROR You seem to be trying to use Box> +pub fn test(foo: Box>) { //~ ERROR you seem to be trying to use `Box>` println!("{:?}", foo.get(0)) } diff --git a/tests/compile-fail/collapsible_if.rs b/tests/compile-fail/collapsible_if.rs index 280744b5b45..cc63e895f1c 100755 --- a/tests/compile-fail/collapsible_if.rs +++ b/tests/compile-fail/collapsible_if.rs @@ -5,13 +5,13 @@ fn main() { let x = "hello"; let y = "world"; - if x == "hello" { //~ERROR This if statement can be collapsed + if x == "hello" { //~ERROR this if statement can be collapsed if y == "world" { println!("Hello world!"); } } - if x == "hello" || x == "world" { //~ERROR This if statement can be collapsed + if x == "hello" || x == "world" { //~ERROR this if statement can be collapsed if y == "world" || y == "hello" { println!("Hello world!"); } diff --git a/tests/compile-fail/eta.rs b/tests/compile-fail/eta.rs old mode 100644 new mode 100755 index 8ca88eecbd2..9e48ec1c3a5 --- a/tests/compile-fail/eta.rs +++ b/tests/compile-fail/eta.rs @@ -5,11 +5,11 @@ fn main() { let a = |a, b| foo(a, b); - //~^ ERROR Redundant closure found, consider using `foo` in its place + //~^ ERROR redundant closure found. Consider using `foo` in its place let c = |a, b| {1+2; foo}(a, b); - //~^ ERROR Redundant closure found, consider using `{ 1 + 2; foo }` in its place + //~^ ERROR redundant closure found. Consider using `{ 1 + 2; foo }` in its place let d = |a, b| foo((|c, d| foo2(c,d))(a,b), b); - //~^ ERROR Redundant closure found, consider using `foo2` in its place + //~^ ERROR redundant closure found. Consider using `foo2` in its place } fn foo(_: u8, _: u8) { @@ -18,4 +18,4 @@ fn foo(_: u8, _: u8) { fn foo2(_: u8, _: u8) -> u8 { 1u8 -} \ No newline at end of file +} diff --git a/tests/compile-fail/len_zero.rs b/tests/compile-fail/len_zero.rs index 48a10042658..3785a518e2b 100755 --- a/tests/compile-fail/len_zero.rs +++ b/tests/compile-fail/len_zero.rs @@ -5,14 +5,14 @@ #[deny(len_without_is_empty)] impl One { - fn len(self: &Self) -> isize { //~ERROR Item 'One' has a '.len(_: &Self)' + fn len(self: &Self) -> isize { //~ERROR item `One` has a `.len(_: &Self)` 1 } } #[deny(len_without_is_empty)] trait TraitsToo { - fn len(self: &Self) -> isize; //~ERROR Trait 'TraitsToo' has a '.len(_: + fn len(self: &Self) -> isize; //~ERROR trait `TraitsToo` has a `.len(_: } impl TraitsToo for One { @@ -56,7 +56,7 @@ fn is_empty(self: &Self) -> bool { #[deny(len_without_is_empty)] impl HasWrongIsEmpty { - fn len(self: &Self) -> isize { //~ERROR Item 'HasWrongIsEmpty' has a '.len(_: &Self)' + fn len(self: &Self) -> isize { //~ERROR item `HasWrongIsEmpty` has a `.len(_: &Self)` 1 } @@ -69,7 +69,7 @@ fn is_empty(self: &Self, x : u32) -> bool { #[deny(len_zero)] fn main() { let x = [1, 2]; - if x.len() == 0 { //~ERROR Consider replacing the len comparison + if x.len() == 0 { //~ERROR consider replacing the len comparison println!("This should not happen!"); } @@ -84,13 +84,13 @@ fn main() { } let hie = HasIsEmpty; - if hie.len() == 0 { //~ERROR Consider replacing the len comparison + if hie.len() == 0 { //~ERROR consider replacing the len comparison println!("Or this!"); } assert!(!hie.is_empty()); let wie : &WithIsEmpty = &Wither; - if wie.len() == 0 { //~ERROR Consider replacing the len comparison + if wie.len() == 0 { //~ERROR consider replacing the len comparison println!("Or this!"); } assert!(!wie.is_empty()); diff --git a/tests/compile-fail/match_if_let.rs b/tests/compile-fail/match_if_let.rs index 47b8b18a5ec..01bfe744713 100755 --- a/tests/compile-fail/match_if_let.rs +++ b/tests/compile-fail/match_if_let.rs @@ -5,8 +5,8 @@ fn main(){ let x = Some(1u8); - match x { //~ ERROR You seem to be trying to use match - //~^ HELP Try + match x { //~ ERROR you seem to be trying to use match + //~^ HELP try Some(y) => { println!("{:?}", y); } @@ -18,8 +18,8 @@ fn main(){ None => () } let z = (1u8,1u8); - match z { //~ ERROR You seem to be trying to use match - //~^ HELP Try + match z { //~ ERROR you seem to be trying to use match + //~^ HELP try (2...3, 7...9) => println!("{:?}", z), _ => {} } diff --git a/tests/compile-fail/modulo_one.rs b/tests/compile-fail/modulo_one.rs old mode 100644 new mode 100755 index 26c7de855e5..1301b4e499c --- a/tests/compile-fail/modulo_one.rs +++ b/tests/compile-fail/modulo_one.rs @@ -3,6 +3,6 @@ #![deny(modulo_one)] fn main() { - 10 % 1; //~ERROR Any number modulo 1 will be 0 + 10 % 1; //~ERROR any number modulo 1 will be 0 10 % 2; } diff --git a/tests/compile-fail/ptr_arg.rs b/tests/compile-fail/ptr_arg.rs index 7ba291b1439..d56ea735a1d 100755 --- a/tests/compile-fail/ptr_arg.rs +++ b/tests/compile-fail/ptr_arg.rs @@ -3,7 +3,7 @@ #[deny(ptr_arg)] #[allow(unused)] -fn do_vec(x: &Vec) { //~ERROR: Writing '&Vec<_>' instead of '&[_]' +fn do_vec(x: &Vec) { //~ERROR: writing `&Vec<_>` instead of `&[_]` //Nothing here } diff --git a/tests/compile-fail/unicode.rs b/tests/compile-fail/unicode.rs index a121b985f09..60edf2577e7 100755 --- a/tests/compile-fail/unicode.rs +++ b/tests/compile-fail/unicode.rs @@ -4,13 +4,13 @@ #[deny(zero_width_space)] fn zero() { print!("Here >​< is a ZWS, and ​another"); - //~^ ERROR Zero-width space detected. Consider using \u{200B} - //~^^ ERROR Zero-width space detected. Consider using \u{200B} + //~^ ERROR zero-width space detected. Consider using `\u{200B}` + //~^^ ERROR zero-width space detected. Consider using `\u{200B}` } //#[deny(unicode_canon)] fn canon() { - print!("̀ah?"); //not yet ~ERROR Non-canonical unicode sequence detected. Consider using à + print!("̀ah?"); //not yet ~ERROR non-canonical unicode sequence detected. Consider using à } //#[deny(ascii_only)]