fix some typos
This commit is contained in:
parent
e73bb00542
commit
88541d6637
@ -102,7 +102,7 @@ let x: Option<u32> = Some(42);
|
||||
m!(x, x.unwrap());
|
||||
```
|
||||
|
||||
If the `m!(x, x.unwrapp());` line is expanded, we would get two expanded
|
||||
If the `m!(x, x.unwrap());` line is expanded, we would get two expanded
|
||||
expressions:
|
||||
|
||||
- `x.is_some()` (from the `$a.is_some()` line in the `m` macro)
|
||||
|
@ -3786,7 +3786,7 @@
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// This pattern is often followed by manual unwrapping of the `Option`. The simplification
|
||||
/// results in more readable and succint code without the need for manual unwrapping.
|
||||
/// results in more readable and succinct code without the need for manual unwrapping.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
@ -3812,7 +3812,7 @@
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// This pattern is often followed by manual unwrapping of `Result`. The simplification
|
||||
/// results in more readable and succint code without the need for manual unwrapping.
|
||||
/// results in more readable and succinct code without the need for manual unwrapping.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```no_run
|
||||
|
@ -331,7 +331,7 @@ fn report_indexes(cx: &LateContext<'_>, map: &UnhashMap<u64, Vec<IndexEntry<'_>>
|
||||
slice,
|
||||
} if indexes.len() > 1 => {
|
||||
// if we have found an `assert!`, let's also check that it's actually right
|
||||
// and if it convers the highest index and if not, suggest the correct length
|
||||
// and if it covers the highest index and if not, suggest the correct length
|
||||
let sugg = match comparison {
|
||||
// `v.len() < 5` and `v.len() <= 5` does nothing in terms of bounds checks.
|
||||
// The user probably meant `v.len() > 5`
|
||||
|
@ -165,7 +165,7 @@ fn check_no_effect(cx: &LateContext<'_>, stmt: &Stmt<'_>) -> bool {
|
||||
}
|
||||
|
||||
fn is_operator_overridden(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
// It's very hard or impossable to check whether overridden operator have side-effect this lint.
|
||||
// It's very hard or impossible to check whether overridden operator have side-effect this lint.
|
||||
// So, this function assume user-defined operator is overridden with an side-effect.
|
||||
// The definition of user-defined structure here is ADT-type,
|
||||
// Althrough this will weaken the ability of this lint, less error lint-fix happen.
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
/// Checks for mis-uses of the serde API.
|
||||
/// Checks for misuses of the serde API.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// Serde is very finnicky about how its API should be
|
||||
|
@ -142,7 +142,7 @@ fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
|
||||
} else {
|
||||
// In this case, the `use_path.span` ends right before the `::*`, so we need to
|
||||
// extend it up to the `*`. Since it is hard to find the `*` in weird
|
||||
// formattings like `use _ :: *;`, we extend it up to, but not including the
|
||||
// formatting like `use _ :: *;`, we extend it up to, but not including the
|
||||
// `;`. In nested imports, like `use _::{inner::*, _}` there is no `;` and we
|
||||
// can just use the end of the item span
|
||||
let mut span = use_path.span.with_hi(item.span.hi());
|
||||
|
@ -38,7 +38,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty {
|
||||
|
||||
ExprKind::Call(callee, args) => {
|
||||
let lhs = expr_type_certainty(cx, callee);
|
||||
let rhs = if type_is_inferrable_from_arguments(cx, expr) {
|
||||
let rhs = if type_is_inferable_from_arguments(cx, expr) {
|
||||
meet(args.iter().map(|arg| expr_type_certainty(cx, arg)))
|
||||
} else {
|
||||
Certainty::Uncertain
|
||||
@ -57,7 +57,7 @@ fn expr_type_certainty(cx: &LateContext<'_>, expr: &Expr<'_>) -> Certainty {
|
||||
receiver_type_certainty = receiver_type_certainty.with_def_id(self_ty_def_id);
|
||||
};
|
||||
let lhs = path_segment_certainty(cx, receiver_type_certainty, method, false);
|
||||
let rhs = if type_is_inferrable_from_arguments(cx, expr) {
|
||||
let rhs = if type_is_inferable_from_arguments(cx, expr) {
|
||||
meet(
|
||||
std::iter::once(receiver_type_certainty).chain(args.iter().map(|arg| expr_type_certainty(cx, arg))),
|
||||
)
|
||||
@ -279,7 +279,7 @@ fn update_res(cx: &LateContext<'_>, parent_certainty: Certainty, path_segment: &
|
||||
}
|
||||
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
fn type_is_inferrable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
fn type_is_inferable_from_arguments(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
||||
let Some(callee_def_id) = (match expr.kind {
|
||||
ExprKind::Call(callee, _) => {
|
||||
let callee_ty = cx.typeck_results().expr_ty(callee);
|
||||
|
@ -17,7 +17,7 @@ fn main() {
|
||||
with_span!(
|
||||
span
|
||||
|
||||
fn coverting() {
|
||||
fn converting() {
|
||||
let x = 0u32 as u64;
|
||||
}
|
||||
);
|
||||
|
@ -184,7 +184,7 @@ fn check_expect_suppression() {
|
||||
let x = 21;
|
||||
}
|
||||
|
||||
mod type_already_infered {
|
||||
mod type_already_inferred {
|
||||
// Should NOT lint if bound to return type
|
||||
fn ret_i32() -> i32 {
|
||||
1
|
||||
|
@ -184,7 +184,7 @@ fn check_expect_suppression() {
|
||||
let x = 21;
|
||||
}
|
||||
|
||||
mod type_already_infered {
|
||||
mod type_already_inferred {
|
||||
// Should NOT lint if bound to return type
|
||||
fn ret_i32() -> i32 {
|
||||
1
|
||||
|
@ -11,7 +11,7 @@ fn main() {
|
||||
let _no_as_str = string.as_bytes();
|
||||
let _no_as_str = string.is_empty();
|
||||
|
||||
// These methods are not redundant, and are equivelant to
|
||||
// These methods are not redundant, and are equivalent to
|
||||
// doing dereferencing the string and applying the method
|
||||
let _not_redundant = string.as_str().escape_unicode();
|
||||
let _not_redundant = string.as_str().trim();
|
||||
|
@ -11,7 +11,7 @@ fn main() {
|
||||
let _no_as_str = string.as_bytes();
|
||||
let _no_as_str = string.is_empty();
|
||||
|
||||
// These methods are not redundant, and are equivelant to
|
||||
// These methods are not redundant, and are equivalent to
|
||||
// doing dereferencing the string and applying the method
|
||||
let _not_redundant = string.as_str().escape_unicode();
|
||||
let _not_redundant = string.as_str().trim();
|
||||
|
@ -113,7 +113,7 @@ fn trivial_regex() {
|
||||
// #6005: unicode classes in bytes::Regex
|
||||
let a_byte_of_unicode = BRegex::new(r"\p{C}");
|
||||
|
||||
// start and end word boundry, introduced in regex 0.10
|
||||
// start and end word boundary, introduced in regex 0.10
|
||||
let _ = BRegex::new(r"\<word\>");
|
||||
let _ = BRegex::new(r"\b{start}word\b{end}");
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ struct NotSnakeCase2 {
|
||||
someData_a_b: bool,
|
||||
}
|
||||
|
||||
// no error, threshold is 3 fiels by default
|
||||
// no error, threshold is 3 fields by default
|
||||
struct Fooo {
|
||||
foo: u8,
|
||||
bar: u8,
|
||||
|
@ -241,7 +241,7 @@ mod issue11300 {
|
||||
foo2::<(), _>([1, 2, 3].into_iter());
|
||||
|
||||
// This should lint. Removing the `.into_iter()` means that `I` gets substituted with `[i32; 3]`,
|
||||
// and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unncessary.
|
||||
// and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unnecessary.
|
||||
foo3([1, 2, 3]);
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ mod issue11300 {
|
||||
|
||||
S1.foo([1, 2]);
|
||||
|
||||
// ICE that occured in itertools
|
||||
// ICE that occurred in itertools
|
||||
trait Itertools {
|
||||
fn interleave_shortest<J>(self, other: J)
|
||||
where
|
||||
|
@ -241,7 +241,7 @@ pub fn bar() {
|
||||
foo2::<(), _>([1, 2, 3].into_iter());
|
||||
|
||||
// This should lint. Removing the `.into_iter()` means that `I` gets substituted with `[i32; 3]`,
|
||||
// and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unncessary.
|
||||
// and `i32: Helper2<[i32, 3]>` is true, so this call is indeed unnecessary.
|
||||
foo3([1, 2, 3].into_iter());
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ pub fn foo<I: IntoIterator>(&self, _: I) {}
|
||||
|
||||
S1.foo([1, 2].into_iter());
|
||||
|
||||
// ICE that occured in itertools
|
||||
// ICE that occurred in itertools
|
||||
trait Itertools {
|
||||
fn interleave_shortest<J>(self, other: J)
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user