Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
This commit is contained in:
commit
1f069c0ce7
|
@ -126,7 +126,7 @@ declare_clippy_lint! {
|
|||
/// Duplicate code is less maintainable.
|
||||
///
|
||||
/// ### Known problems
|
||||
/// * The lint doesn't check if the moved expressions modify values that are beeing used in
|
||||
/// * The lint doesn't check if the moved expressions modify values that are being used in
|
||||
/// the if condition. The suggestion can in that case modify the behavior of the program.
|
||||
/// See [rust-clippy#7452](https://github.com/rust-lang/rust-clippy/issues/7452)
|
||||
///
|
||||
|
|
|
@ -86,9 +86,9 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_items: &[h
|
|||
|
||||
// check for `unwrap`
|
||||
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
|
||||
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result)
|
||||
let receiver_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, receiver_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, receiver_ty, sym::Result)
|
||||
{
|
||||
self.result.push(expr.span);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Known problems
|
||||
/// If the user can ensure that b is larger than a, the `.abs()` is
|
||||
/// technically unneccessary. However, it will make the code more robust and doesn't have any
|
||||
/// technically unnecessary. However, it will make the code more robust and doesn't have any
|
||||
/// large performance implications. If the abs call was deliberately left out for performance
|
||||
/// reasons, it is probably better to state this explicitly in the code, which then can be done
|
||||
/// with an allow.
|
||||
|
@ -69,7 +69,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatEqualityWithoutAbs {
|
|||
|
||||
if_chain! {
|
||||
|
||||
// left hand side is a substraction
|
||||
// left hand side is a subtraction
|
||||
if let ExprKind::Binary(
|
||||
Spanned {
|
||||
node: BinOpKind::Sub,
|
||||
|
@ -84,7 +84,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatEqualityWithoutAbs {
|
|||
if let Res::Def(DefKind::AssocConst, def_id) = cx.qpath_res(epsilon_path, rhs.hir_id);
|
||||
if match_def_path(cx, def_id, &paths::F32_EPSILON) || match_def_path(cx, def_id, &paths::F64_EPSILON);
|
||||
|
||||
// values of the substractions on the left hand side are of the type float
|
||||
// values of the subtractions on the left hand side are of the type float
|
||||
let t_val_l = cx.typeck_results().expr_ty(val_l);
|
||||
let t_val_r = cx.typeck_results().expr_ty(val_r);
|
||||
if let ty::Float(_) = t_val_l.kind();
|
||||
|
|
|
@ -224,7 +224,7 @@ pub fn is_array(ty: Ty<'_>) -> bool {
|
|||
/// This builds the graph of side effect.
|
||||
/// The edge `a -> b` means if `a` has side effect, `b` will have side effect.
|
||||
///
|
||||
/// There are some exmaple in following code:
|
||||
/// There are some example in following code:
|
||||
/// ```rust, ignore
|
||||
/// let b = 1;
|
||||
/// let a = b; // a -> b
|
||||
|
|
|
@ -290,7 +290,7 @@ fn ident_swap_sugg(
|
|||
// used instead, in these cases.
|
||||
*applicability = Applicability::MaybeIncorrect;
|
||||
|
||||
// We arbitraily choose one side to suggest changing,
|
||||
// We arbitrarily choose one side to suggest changing,
|
||||
// since we don't have a better guess. If the user
|
||||
// ends up duplicating a clause, the `logic_bug` lint
|
||||
// should catch it.
|
||||
|
@ -374,19 +374,19 @@ fn strip_non_ident_wrappers(expr: &Expr) -> &Expr {
|
|||
}
|
||||
|
||||
fn extract_related_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
|
||||
append_opt_vecs(chained_binops(kind), if_statment_binops(kind))
|
||||
append_opt_vecs(chained_binops(kind), if_statement_binops(kind))
|
||||
}
|
||||
|
||||
fn if_statment_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
|
||||
fn if_statement_binops(kind: &ExprKind) -> Option<Vec<BinaryOp<'_>>> {
|
||||
match kind {
|
||||
ExprKind::If(ref condition, _, _) => chained_binops(&condition.kind),
|
||||
ExprKind::Paren(ref e) => if_statment_binops(&e.kind),
|
||||
ExprKind::Paren(ref e) => if_statement_binops(&e.kind),
|
||||
ExprKind::Block(ref block, _) => {
|
||||
let mut output = None;
|
||||
for stmt in &block.stmts {
|
||||
match stmt.kind {
|
||||
StmtKind::Expr(ref e) | StmtKind::Semi(ref e) => {
|
||||
output = append_opt_vecs(output, if_statment_binops(&e.kind));
|
||||
output = append_opt_vecs(output, if_statement_binops(&e.kind));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ declare_clippy_lint! {
|
|||
/// Displays a warning when a struct with a trailing zero-sized array is declared without a `repr` attribute.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters (for example, in conjuction with manual allocation to make it easy to compute the offset of the array). Either way, `#[repr(C)]` (or another `repr` attribute) is needed.
|
||||
/// Zero-sized arrays aren't very useful in Rust itself, so such a struct is likely being created to pass to C code or in some other situation where control over memory layout matters (for example, in conjunction with manual allocation to make it easy to compute the offset of the array). Either way, `#[repr(C)]` (or another `repr` attribute) is needed.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
|
|
|
@ -46,7 +46,7 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Why is this bad?
|
||||
/// Duplicate bounds makes the code
|
||||
/// less readable than specifing them only once.
|
||||
/// less readable than specifying them only once.
|
||||
///
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
|
|
|
@ -83,9 +83,9 @@ impl<'a, 'tcx> Visitor<'tcx> for FindExpectUnwrap<'a, 'tcx> {
|
|||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
// check for `expect`
|
||||
if let Some(arglists) = method_chain_args(expr, &["expect"]) {
|
||||
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result)
|
||||
let receiver_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, receiver_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, receiver_ty, sym::Result)
|
||||
{
|
||||
self.result.push(expr.span);
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ impl<'a, 'tcx> Visitor<'tcx> for FindExpectUnwrap<'a, 'tcx> {
|
|||
|
||||
// check for `unwrap`
|
||||
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
|
||||
let reciever_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, reciever_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, reciever_ty, sym::Result)
|
||||
let receiver_ty = self.typeck_results.expr_ty(&arglists[0][0]).peel_refs();
|
||||
if is_type_diagnostic_item(self.lcx, receiver_ty, sym::Option)
|
||||
|| is_type_diagnostic_item(self.lcx, receiver_ty, sym::Result)
|
||||
{
|
||||
self.result.push(expr.span);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ impl Message {
|
|||
fn new(path: PathBuf) -> Self {
|
||||
let content: String = std::fs::read_to_string(&path).unwrap();
|
||||
// we don't want the first letter after "error: ", "help: " ... to be capitalized
|
||||
// also no puncutation (except for "?" ?) at the end of a line
|
||||
// also no punctuation (except for "?" ?) at the end of a line
|
||||
let regex_set: RegexSet = RegexSet::new(&[
|
||||
r"error: [A-Z]",
|
||||
r"help: [A-Z]",
|
||||
|
|
|
@ -59,7 +59,7 @@ pub fn manual_copy_with_counters(src: &[i32], dst: &mut [i32], dst2: &mut [i32])
|
|||
}
|
||||
|
||||
// make sure parentheses are added properly to bitwise operators, which have lower precedence than
|
||||
// arithmetric ones
|
||||
// arithmetic ones
|
||||
let mut count = 0 << 1;
|
||||
for i in 0..1 << 1 {
|
||||
dst[count] = src[i + 2];
|
||||
|
|
|
@ -93,7 +93,7 @@ fn test_no_deps_ignores_path_deps_in_workspaces() {
|
|||
output
|
||||
};
|
||||
|
||||
// Trigger a sucessful build, so Cargo would like to cache the build result.
|
||||
// Trigger a successful build, so Cargo would like to cache the build result.
|
||||
successful_build();
|
||||
|
||||
// Make sure there's no spurious rebuild when nothing changes.
|
||||
|
|
Loading…
Reference in New Issue