Reduce typo count.

This commit is contained in:
Bruce Mitchener 2024-07-20 12:50:36 +07:00
parent 057c4ae287
commit cf4270d13b
9 changed files with 13 additions and 13 deletions

View file

@ -232,7 +232,7 @@ impl<'a, 'tcx> SigDropChecker<'a, 'tcx> {
enum SigDropHolder { enum SigDropHolder {
/// No values with significant drop present in this expression. /// No values with significant drop present in this expression.
/// ///
/// Expressions that we've emited lints do not count. /// Expressions that we've emitted lints do not count.
None, None,
/// Some field in this expression references to values with significant drop. /// Some field in this expression references to values with significant drop.
/// ///
@ -426,7 +426,7 @@ fn ty_has_erased_regions(ty: Ty<'_>) -> bool {
impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) { fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
// We've emited a lint on some neighborhood expression. That lint will suggest to move out the // We've emitted a lint on some neighborhood expression. That lint will suggest to move out the
// _parent_ expression (not the expression itself). Since we decide to move out the parent // _parent_ expression (not the expression itself). Since we decide to move out the parent
// expression, it is pointless to continue to process the current expression. // expression, it is pointless to continue to process the current expression.
if self.sig_drop_holder == SigDropHolder::Moved { if self.sig_drop_holder == SigDropHolder::Moved {
@ -450,7 +450,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
ExprKind::Assign(lhs, _, _) | ExprKind::AssignOp(_, lhs, _) ExprKind::Assign(lhs, _, _) | ExprKind::AssignOp(_, lhs, _)
if lhs.hir_id == ex.hir_id && self.sig_drop_holder == SigDropHolder::Moved => if lhs.hir_id == ex.hir_id && self.sig_drop_holder == SigDropHolder::Moved =>
{ {
// Never move out only the assignee. Instead, we should always move out the whole assigment. // Never move out only the assignee. Instead, we should always move out the whole assignment.
self.replace_current_sig_drop(parent_ex.span, true, 0); self.replace_current_sig_drop(parent_ex.span, true, 0);
}, },
_ => { _ => {

View file

@ -394,8 +394,8 @@ fn check_final_expr<'tcx>(
// Returns may be used to turn an expression into a statement in rustc's AST. // Returns may be used to turn an expression into a statement in rustc's AST.
// This allows the addition of attributes, like `#[allow]` (See: clippy#9361) // This allows the addition of attributes, like `#[allow]` (See: clippy#9361)
// `#[expect(clippy::needless_return)]` needs to be handled separatly to // `#[expect(clippy::needless_return)]` needs to be handled separately to
// actually fullfil the expectation (clippy::#12998) // actually fulfill the expectation (clippy::#12998)
match cx.tcx.hir().attrs(expr.hir_id) { match cx.tcx.hir().attrs(expr.hir_id) {
[] => {}, [] => {},
[attr] => { [attr] => {

View file

@ -77,10 +77,10 @@ impl ClippyWarning {
.iter() .iter()
.find(|span| span.is_primary) .find(|span| span.is_primary)
.or(diag.spans.first()) .or(diag.spans.first())
.unwrap_or_else(|| panic!("Diagnositc without span: {diag}")); .unwrap_or_else(|| panic!("Diagnostic without span: {diag}"));
let file = &span.file_name; let file = &span.file_name;
let url = if let Some(src_split) = file.find("/src/") { let url = if let Some(src_split) = file.find("/src/") {
// This removes the inital `target/lintcheck/sources/<crate>-<version>/` // This removes the initial `target/lintcheck/sources/<crate>-<version>/`
let src_split = src_split + "/src/".len(); let src_split = src_split + "/src/".len();
let (_, file) = file.split_at(src_split); let (_, file) = file.split_at(src_split);

View file

@ -45,7 +45,7 @@ fn main() {
let _ = unsafe { *core::ptr::addr_of!(a) }; let _ = unsafe { *core::ptr::addr_of!(a) };
let _repeat = [0; 64]; let _repeat = [0; 64];
// do NOT lint for array as sematic differences with/out `*&`. // do NOT lint for array as semantic differences with/out `*&`.
let _arr = *&[0, 1, 2, 3, 4]; let _arr = *&[0, 1, 2, 3, 4];
} }

View file

@ -45,7 +45,7 @@ fn main() {
let _ = unsafe { *core::ptr::addr_of!(a) }; let _ = unsafe { *core::ptr::addr_of!(a) };
let _repeat = *&[0; 64]; let _repeat = *&[0; 64];
// do NOT lint for array as sematic differences with/out `*&`. // do NOT lint for array as semantic differences with/out `*&`.
let _arr = *&[0, 1, 2, 3, 4]; let _arr = *&[0, 1, 2, 3, 4];
} }

View file

@ -200,7 +200,7 @@ mod with_ty_alias {
} }
// NOTE: When checking the type of a function param, make sure it is not an alias with // NOTE: When checking the type of a function param, make sure it is not an alias with
// `AliasTyKind::Projection` before calling `TyCtxt::type_of` to find out what the actual type // `AliasTyKind::Projection` before calling `TyCtxt::type_of` to find out what the actual type
// is. Because the associate ty could have no default, therefore would cause ICE, as demostrated // is. Because the associate ty could have no default, therefore would cause ICE, as demonstrated
// in this test. // in this test.
const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {} const fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
} }

View file

@ -200,7 +200,7 @@ mod with_ty_alias {
} }
// NOTE: When checking the type of a function param, make sure it is not an alias with // NOTE: When checking the type of a function param, make sure it is not an alias with
// `AliasTyKind::Projection` before calling `TyCtxt::type_of` to find out what the actual type // `AliasTyKind::Projection` before calling `TyCtxt::type_of` to find out what the actual type
// is. Because the associate ty could have no default, therefore would cause ICE, as demostrated // is. Because the associate ty could have no default, therefore would cause ICE, as demonstrated
// in this test. // in this test.
fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {} fn alias_ty_is_projection(bar: <() as FooTrait>::Foo) {}
} }

View file

@ -20,7 +20,7 @@ fn main() {
f(); b = [] as [i32; 0]; f(); b = [] as [i32; 0];
// on vecs // on vecs
// vecs dont support infering value of consts // vecs dont support inferring value of consts
f(); let c: std::vec::Vec<i32> = vec![]; f(); let c: std::vec::Vec<i32> = vec![];
let d; let d;
f(); d = vec![] as std::vec::Vec<i32>; f(); d = vec![] as std::vec::Vec<i32>;

View file

@ -20,7 +20,7 @@ fn main() {
b = [f(); 0]; b = [f(); 0];
// on vecs // on vecs
// vecs dont support infering value of consts // vecs dont support inferring value of consts
let c = vec![f(); 0]; let c = vec![f(); 0];
let d; let d;
d = vec![f(); 0]; d = vec![f(); 0];