Fix some formatting issues
This commit is contained in:
parent
1751d2496d
commit
63fa5d24e1
14 changed files with 120 additions and 139 deletions
|
@ -29,8 +29,7 @@ use if_chain::if_chain;
|
|||
declare_clippy_lint! {
|
||||
pub EXPLICIT_WRITE,
|
||||
complexity,
|
||||
"using the `write!()` family of functions instead of the `print!()` family \
|
||||
of functions, when using the latter would work"
|
||||
"using the `write!()` family of functions instead of the `print!()` family of functions, when using the latter would work"
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
|
|
@ -251,8 +251,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub UNUSED_COLLECT,
|
||||
perf,
|
||||
"`collect()`ing an iterator without using the result; this is usually better \
|
||||
written as a for loop"
|
||||
"`collect()`ing an iterator without using the result; this is usually better written as a for loop"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for functions collecting an iterator when collect
|
||||
|
|
|
@ -81,7 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, name, None) => {
|
||||
match closure_expr.node {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner) => {
|
||||
if !cx.tables.expr_ty(inner).is_box() => {
|
||||
if !cx.tables.expr_ty(inner).is_box() {
|
||||
lint(cx, e.span, args[0].span, name, inner);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -42,8 +42,7 @@ use std::collections::Bound;
|
|||
declare_clippy_lint! {
|
||||
pub SINGLE_MATCH,
|
||||
style,
|
||||
"a match statement with a single nontrivial arm (i.e. where the other arm \
|
||||
is `_ => {}`) instead of `if let`"
|
||||
"a match statement with a single nontrivial arm (i.e. where the other arm is `_ => {}`) instead of `if let`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for matches with a two arms where an `if let` will
|
||||
|
@ -63,8 +62,7 @@ style,
|
|||
declare_clippy_lint! {
|
||||
pub SINGLE_MATCH_ELSE,
|
||||
pedantic,
|
||||
"a match statement with a two arms where the second arm's pattern is a wildcard \
|
||||
instead of `if let`"
|
||||
"a match statement with a two arms where the second arm's pattern is a wildcard instead of `if let`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for matches where all arms match a reference,
|
||||
|
|
|
@ -133,8 +133,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub WRONG_SELF_CONVENTION,
|
||||
style,
|
||||
"defining a method named with an established prefix (like \"into_\") that takes \
|
||||
`self` with the wrong convention"
|
||||
"defining a method named with an established prefix (like \"into_\") that takes `self` with the wrong convention"
|
||||
}
|
||||
|
||||
/// **What it does:** This is the same as
|
||||
|
@ -157,8 +156,7 @@ style,
|
|||
declare_clippy_lint! {
|
||||
pub WRONG_PUB_SELF_CONVENTION,
|
||||
restriction,
|
||||
"defining a public method named with an established prefix (like \"into_\") that takes \
|
||||
`self` with the wrong convention"
|
||||
"defining a public method named with an established prefix (like \"into_\") that takes `self` with the wrong convention"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `ok().expect(..)`.
|
||||
|
@ -175,8 +173,7 @@ restriction,
|
|||
declare_clippy_lint! {
|
||||
pub OK_EXPECT,
|
||||
style,
|
||||
"using `ok().expect()`, which gives worse error messages than \
|
||||
calling `expect` directly on the Result"
|
||||
"using `ok().expect()`, which gives worse error messages than calling `expect` directly on the Result"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `_.map(_).unwrap_or(_)`.
|
||||
|
@ -211,8 +208,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub OPTION_MAP_UNWRAP_OR_ELSE,
|
||||
pedantic,
|
||||
"using `Option.map(f).unwrap_or_else(g)`, which is more succinctly expressed as \
|
||||
`map_or_else(g, f)`"
|
||||
"using `Option.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `map_or_else(g, f)`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `result.map(_).unwrap_or_else(_)`.
|
||||
|
@ -229,8 +225,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub RESULT_MAP_UNWRAP_OR_ELSE,
|
||||
pedantic,
|
||||
"using `Result.map(f).unwrap_or_else(g)`, which is more succinctly expressed as \
|
||||
`.ok().map_or_else(g, f)`"
|
||||
"using `Result.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `.ok().map_or_else(g, f)`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `_.map_or(None, _)`.
|
||||
|
@ -247,8 +242,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub OPTION_MAP_OR_NONE,
|
||||
style,
|
||||
"using `Option.map_or(None, f)`, which is more succinctly expressed as \
|
||||
`and_then(f)`"
|
||||
"using `Option.map_or(None, f)`, which is more succinctly expressed as `and_then(f)`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `_.filter(_).next()`.
|
||||
|
@ -282,8 +276,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub MAP_FLATTEN,
|
||||
pedantic,
|
||||
"using combinations of `flatten` and `map` which can usually be written as a \
|
||||
single method call"
|
||||
"using combinations of `flatten` and `map` which can usually be written as a single method call"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `_.filter(_).map(_)`,
|
||||
|
@ -302,8 +295,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub FILTER_MAP,
|
||||
pedantic,
|
||||
"using combinations of `filter`, `map`, `filter_map` and `flat_map` which can \
|
||||
usually be written as a single method call"
|
||||
"using combinations of `filter`, `map`, `filter_map` and `flat_map` which can usually be written as a single method call"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for an iterator search (such as `find()`,
|
||||
|
@ -321,8 +313,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub SEARCH_IS_SOME,
|
||||
complexity,
|
||||
"using an iterator search followed by `is_some()`, which is more succinctly \
|
||||
expressed as a call to `any()`"
|
||||
"using an iterator search followed by `is_some()`, which is more succinctly expressed as a call to `any()`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for usage of `.chars().next()` on a `str` to check
|
||||
|
@ -487,8 +478,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub SINGLE_CHAR_PATTERN,
|
||||
perf,
|
||||
"using a single-character str where a char could be used, e.g. \
|
||||
`_.split(\"x\")`"
|
||||
"using a single-character str where a char could be used, e.g. `_.split(\"x\")`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for getting the inner pointer of a temporary
|
||||
|
|
|
@ -29,8 +29,7 @@ use crate::utils::span_lint;
|
|||
declare_clippy_lint! {
|
||||
pub UNNECESSARY_MUT_PASSED,
|
||||
style,
|
||||
"an argument passed as a mutable reference although the callee only demands an \
|
||||
immutable reference"
|
||||
"an argument passed as a mutable reference although the callee only demands an immutable reference"
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
|
@ -42,8 +42,7 @@ use crate::utils::{in_macro, snippet_with_applicability, span_lint, span_lint_an
|
|||
declare_clippy_lint! {
|
||||
pub NEEDLESS_BOOL,
|
||||
complexity,
|
||||
"if-statements with plain booleans in the then- and else-clause, e.g. \
|
||||
`if p { true } else { false }`"
|
||||
"if-statements with plain booleans in the then- and else-clause, e.g. `if p { true } else { false }`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for expressions of the form `x == true` (or vice
|
||||
|
|
|
@ -56,8 +56,7 @@ use std::borrow::Cow;
|
|||
declare_clippy_lint! {
|
||||
pub PTR_ARG,
|
||||
style,
|
||||
"fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` \
|
||||
instead, respectively"
|
||||
"fn arguments of the type `&Vec<...>` or `&String`, suggesting to use `&[...]` or `&str` instead, respectively"
|
||||
}
|
||||
|
||||
/// **What it does:** This lint checks for equality comparisons with `ptr::null`
|
||||
|
|
|
@ -67,8 +67,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub LET_AND_RETURN,
|
||||
style,
|
||||
"creating a let-binding and then immediately returning it like `let x = expr; x` at \
|
||||
the end of a block"
|
||||
"creating a let-binding and then immediately returning it like `let x = expr; x` at the end of a block"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for unit (`()`) expressions that can be removed.
|
||||
|
|
|
@ -58,8 +58,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub SHADOW_REUSE,
|
||||
restriction,
|
||||
"rebinding a name to an expression that re-uses the original value, e.g. \
|
||||
`let x = x + 1`"
|
||||
"rebinding a name to an expression that re-uses the original value, e.g. `let x = x + 1`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for bindings that shadow other bindings already in
|
||||
|
|
|
@ -81,6 +81,7 @@ declare_clippy_lint! {
|
|||
/// **Example:**
|
||||
/// ```rust
|
||||
/// let _: &T = std::mem::transmute(p); // where p: *const T
|
||||
///
|
||||
/// // can be written:
|
||||
/// let _: &T = &*p;
|
||||
/// ```
|
||||
|
@ -108,6 +109,7 @@ declare_clippy_lint! {
|
|||
/// **Example:**
|
||||
/// ```rust
|
||||
/// let _: char = std::mem::transmute(x); // where x: u32
|
||||
///
|
||||
/// // should be:
|
||||
/// let _ = std::char::from_u32(x).unwrap();
|
||||
/// ```
|
||||
|
@ -135,6 +137,7 @@ declare_clippy_lint! {
|
|||
/// **Example:**
|
||||
/// ```rust
|
||||
/// let _: &str = std::mem::transmute(b); // where b: &[u8]
|
||||
///
|
||||
/// // should be:
|
||||
/// let _ = std::str::from_utf8(b).unwrap();
|
||||
/// ```
|
||||
|
@ -153,6 +156,7 @@ declare_clippy_lint! {
|
|||
/// **Example:**
|
||||
/// ```rust
|
||||
/// let _: bool = std::mem::transmute(x); // where x: u8
|
||||
///
|
||||
/// // should be:
|
||||
/// let _: bool = x != 0;
|
||||
/// ```
|
||||
|
@ -171,6 +175,7 @@ declare_clippy_lint! {
|
|||
/// **Example:**
|
||||
/// ```rust
|
||||
/// let _: f32 = std::mem::transmute(x); // where x: u32
|
||||
///
|
||||
/// // should be:
|
||||
/// let _: f32 = f32::from_bits(x);
|
||||
/// ```
|
||||
|
|
|
@ -119,8 +119,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub LINKEDLIST,
|
||||
pedantic,
|
||||
"usage of LinkedList, usually a vector is faster, or a more specialized data \
|
||||
structure like a VecDeque"
|
||||
"usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for use of `&Box<T>` anywhere in the code.
|
||||
|
@ -670,8 +669,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub CAST_POSSIBLE_TRUNCATION,
|
||||
pedantic,
|
||||
"casts that may cause truncation of the value, e.g. `x as u8` where `x: u32`, \
|
||||
or `x as i32` where `x: f32`"
|
||||
"casts that may cause truncation of the value, e.g. `x as u8` where `x: u32`, or `x as i32` where `x: f32`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for casts from an unsigned type to a signed type of
|
||||
|
@ -694,8 +692,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub CAST_POSSIBLE_WRAP,
|
||||
pedantic,
|
||||
"casts that may cause wrapping around the value, e.g. `x as i32` where `x: u32` \
|
||||
and `x > i32::MAX`"
|
||||
"casts that may cause wrapping around the value, e.g. `x as i32` where `x: u32` and `x > i32::MAX`"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for on casts between numerical types that may
|
||||
|
|
|
@ -47,8 +47,7 @@ declare_clippy_lint! {
|
|||
declare_clippy_lint! {
|
||||
pub NON_ASCII_LITERAL,
|
||||
pedantic,
|
||||
"using any literal non-ASCII chars in a string literal instead of \
|
||||
using the `\\u` escape"
|
||||
"using any literal non-ASCII chars in a string literal instead of using the `\\u` escape"
|
||||
}
|
||||
|
||||
/// **What it does:** Checks for string literals that contain Unicode in a form
|
||||
|
@ -65,8 +64,7 @@ pedantic,
|
|||
declare_clippy_lint! {
|
||||
pub UNICODE_NOT_NFC,
|
||||
pedantic,
|
||||
"using a unicode literal not in NFC normal form (see \
|
||||
[unicode tr15](http://www.unicode.org/reports/tr15/) for further information)"
|
||||
"using a unicode literal not in NFC normal form (see [unicode tr15](http://www.unicode.org/reports/tr15/) for further information)"
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue