Skip to content

Commit 355c944

Browse files
committed
Auto merge of #16448 - Young-Flash:typos, r=lnicola
minor: correct typos I use [crate-ci/typos](https://github.com/crate-ci/typos) to check typos in codebase, if it's ok with you, I'd like to add a typo check CI using [typos](https://github.com/crate-ci/typos) (with Apache-2.0, MIT licenses). BTW, we can add a [_typos.toml](https://github.com/crate-ci/typos/blob/master/docs/reference.md) as white list for some intentional typos
2 parents 9d837a6 + 62ff8f3 commit 355c944

File tree

23 files changed

+40
-40
lines changed

23 files changed

+40
-40
lines changed

crates/hir-def/src/hir/format_args.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub(crate) fn parse(
214214

215215
let mut used = vec![false; args.explicit_args().len()];
216216
let mut invalid_refs = Vec::new();
217-
let mut numeric_refences_to_named_arg = Vec::new();
217+
let mut numeric_references_to_named_arg = Vec::new();
218218

219219
enum ArgRef<'a> {
220220
Index(usize),
@@ -231,7 +231,7 @@ pub(crate) fn parse(
231231
used[index] = true;
232232
if arg.kind.ident().is_some() {
233233
// This was a named argument, but it was used as a positional argument.
234-
numeric_refences_to_named_arg.push((index, span, used_as));
234+
numeric_references_to_named_arg.push((index, span, used_as));
235235
}
236236
Ok(index)
237237
} else {

crates/hir-def/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl InTypeConstId {
745745
}
746746
}
747747

748-
/// A constant, which might appears as a const item, an annonymous const block in expressions
748+
/// A constant, which might appears as a const item, an anonymous const block in expressions
749749
/// or patterns, or as a constant in types with const generics.
750750
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
751751
pub enum GeneralConstId {

crates/hir-def/src/macro_expansion_tests/mbe/regression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn main() {
7272
}
7373
"#]],
7474
);
75-
// FIXME we should ahev testing infra for multi level expansion tests
75+
// FIXME we should have testing infra for multi level expansion tests
7676
check(
7777
r#"
7878
macro_rules! __rust_force_expr {

crates/hir-def/src/nameres/path_resolution.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl DefMap {
269269
stdx::never!(module.is_block_module());
270270

271271
if self.block != def_map.block {
272-
// If we have a different `DefMap` from `self` (the orignal `DefMap` we started
272+
// If we have a different `DefMap` from `self` (the original `DefMap` we started
273273
// with), resolve the remaining path segments in that `DefMap`.
274274
let path =
275275
ModPath::from_segments(PathKind::Super(0), path.segments().iter().cloned());
@@ -540,7 +540,7 @@ impl DefMap {
540540
}
541541
}
542542

543-
/// Given a block module, returns its nearest non-block module and the `DefMap` it blongs to.
543+
/// Given a block module, returns its nearest non-block module and the `DefMap` it belongs to.
544544
fn adjust_to_nearest_non_block_module(
545545
db: &dyn DefDatabase,
546546
def_map: &DefMap,

crates/hir-ty/src/mir/eval.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ impl MirEvalError {
362362
func
363363
)?;
364364
}
365-
Either::Right(clos) => {
366-
writeln!(f, "In {:?}", clos)?;
365+
Either::Right(closure) => {
366+
writeln!(f, "In {:?}", closure)?;
367367
}
368368
}
369369
let source_map = db.body_with_source_map(*def).1;

crates/hir-ty/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics {
192192
/// and it doesn't store the closure types and fields.
193193
///
194194
/// Codes should not assume this ordering, and should always use methods available
195-
/// on this struct for retriving, and `TyBuilder::substs_for_closure` for creating.
195+
/// on this struct for retrieving, and `TyBuilder::substs_for_closure` for creating.
196196
pub(crate) struct ClosureSubst<'a>(pub(crate) &'a Substitution);
197197

198198
impl<'a> ClosureSubst<'a> {

crates/ide-assists/src/handlers/add_missing_impl_members.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,17 @@ impl<U> Foo<U> for S {
370370
add_missing_impl_members,
371371
r#"
372372
pub trait Trait<'a, 'b, A, B, C> {
373-
fn foo(&self, one: &'a A, anoter: &'b B) -> &'a C;
373+
fn foo(&self, one: &'a A, another: &'b B) -> &'a C;
374374
}
375375
376376
impl<'x, 'y, T, V, U> Trait<'x, 'y, T, V, U> for () {$0}"#,
377377
r#"
378378
pub trait Trait<'a, 'b, A, B, C> {
379-
fn foo(&self, one: &'a A, anoter: &'b B) -> &'a C;
379+
fn foo(&self, one: &'a A, another: &'b B) -> &'a C;
380380
}
381381
382382
impl<'x, 'y, T, V, U> Trait<'x, 'y, T, V, U> for () {
383-
fn foo(&self, one: &'x T, anoter: &'y V) -> &'x U {
383+
fn foo(&self, one: &'x T, another: &'y V) -> &'x U {
384384
${0:todo!()}
385385
}
386386
}"#,
@@ -393,7 +393,7 @@ impl<'x, 'y, T, V, U> Trait<'x, 'y, T, V, U> for () {
393393
add_missing_default_members,
394394
r#"
395395
pub trait Trait<'a, 'b, A, B, C: Default> {
396-
fn foo(&self, _one: &'a A, _anoter: &'b B) -> (C, &'a i32) {
396+
fn foo(&self, _one: &'a A, _another: &'b B) -> (C, &'a i32) {
397397
let value: &'a i32 = &0;
398398
(C::default(), value)
399399
}
@@ -402,14 +402,14 @@ pub trait Trait<'a, 'b, A, B, C: Default> {
402402
impl<'x, 'y, T, V, U: Default> Trait<'x, 'y, T, V, U> for () {$0}"#,
403403
r#"
404404
pub trait Trait<'a, 'b, A, B, C: Default> {
405-
fn foo(&self, _one: &'a A, _anoter: &'b B) -> (C, &'a i32) {
405+
fn foo(&self, _one: &'a A, _another: &'b B) -> (C, &'a i32) {
406406
let value: &'a i32 = &0;
407407
(C::default(), value)
408408
}
409409
}
410410
411411
impl<'x, 'y, T, V, U: Default> Trait<'x, 'y, T, V, U> for () {
412-
$0fn foo(&self, _one: &'x T, _anoter: &'y V) -> (U, &'x i32) {
412+
$0fn foo(&self, _one: &'x T, _another: &'y V) -> (U, &'x i32) {
413413
let value: &'x i32 = &0;
414414
(<U>::default(), value)
415415
}

crates/ide-assists/src/handlers/extract_variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
163163
block
164164
} else {
165165
// `expr_replace` is a descendant of `to_wrap`, so both steps need to be
166-
// handled seperately, otherwise we wrap the wrong expression
166+
// handled separately, otherwise we wrap the wrong expression
167167
let to_wrap = edit.make_mut(to_wrap);
168168

169169
// Replace the target expr first so that we don't need to find where

crates/ide-assists/src/handlers/generate_delegate_trait.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ fn remove_useless_where_clauses(trait_ty: &ast::Type, self_ty: &ast::Type, wc: a
491491

492492
// Generate generic args that should be apply to current impl.
493493
//
494-
// For exmaple, say we have implementation `impl<A, B, C> Trait for B<A>`,
494+
// For example, say we have implementation `impl<A, B, C> Trait for B<A>`,
495495
// and `b: B<T>` in struct `S<T>`. Then the `A` should be instantiated to `T`.
496496
// While the last two generic args `B` and `C` doesn't change, it remains
497497
// `<B, C>`. So we apply `<T, B, C>` as generic arguments to impl.
@@ -637,7 +637,7 @@ fn const_assoc_item(item: syntax::ast::Const, qual_path_ty: ast::Path) -> Option
637637
let path_expr_segment = make::path_from_text(item.name()?.to_string().as_str());
638638

639639
// We want rhs of the const assignment to be a qualified path
640-
// The general case for const assigment can be found [here](`https://doc.rust-lang.org/reference/items/constant-items.html`)
640+
// The general case for const assignment can be found [here](`https://doc.rust-lang.org/reference/items/constant-items.html`)
641641
// The qualified will have the following generic syntax :
642642
// <Base as Trait<GenArgs>>::ConstName;
643643
// FIXME : We can't rely on `make::path_qualified` for now but it would be nice to replace the following with it.
@@ -779,7 +779,7 @@ impl Trait for Base {}
779779

780780
#[test]
781781
fn test_self_ty() {
782-
// trait whith `Self` type cannot be delegated
782+
// trait with `Self` type cannot be delegated
783783
//
784784
// See the function `fn f() -> Self`.
785785
// It should be `fn f() -> Base` in `Base`, and `fn f() -> S` in `S`

crates/ide-assists/src/handlers/generate_mut_trait_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use syntax::{
66

77
use crate::{AssistContext, AssistId, AssistKind, Assists};
88

9-
// FIXME: Generate proper `index_mut` method body refer to `index` method body may impossible due to the unpredicable case [#15581].
9+
// FIXME: Generate proper `index_mut` method body refer to `index` method body may impossible due to the unpredictable case [#15581].
1010
// Here just leave the `index_mut` method body be same as `index` method body, user can modify it manually to meet their need.
1111

1212
// Assist: generate_mut_trait_impl

crates/ide-assists/src/handlers/generate_trait_from_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn remove_items_visibility(item: &ast::AssocItem) {
183183
fn strip_body(item: &ast::AssocItem) {
184184
if let ast::AssocItem::Fn(f) = item {
185185
if let Some(body) = f.body() {
186-
// In constrast to function bodies, we want to see no ws before a semicolon.
186+
// In contrast to function bodies, we want to see no ws before a semicolon.
187187
// So let's remove them if we see any.
188188
if let Some(prev) = body.syntax().prev_sibling_or_token() {
189189
if prev.kind() == SyntaxKind::WHITESPACE {

crates/ide-completion/src/completions/dot.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) fn complete_dot(
3131
}
3232

3333
let is_field_access = matches!(dot_access.kind, DotAccessKind::Field { .. });
34-
let is_method_acces_with_parens =
34+
let is_method_access_with_parens =
3535
matches!(dot_access.kind, DotAccessKind::Method { has_parens: true });
3636

3737
complete_fields(
@@ -41,7 +41,7 @@ pub(crate) fn complete_dot(
4141
|acc, field, ty| acc.add_field(ctx, dot_access, None, field, &ty),
4242
|acc, field, ty| acc.add_tuple_field(ctx, None, field, &ty),
4343
is_field_access,
44-
is_method_acces_with_parens,
44+
is_method_access_with_parens,
4545
);
4646

4747
complete_methods(ctx, receiver_ty, |func| acc.add_method(ctx, dot_access, func, None, None));
@@ -114,14 +114,14 @@ fn complete_fields(
114114
mut named_field: impl FnMut(&mut Completions, hir::Field, hir::Type),
115115
mut tuple_index: impl FnMut(&mut Completions, usize, hir::Type),
116116
is_field_access: bool,
117-
is_method_acess_with_parens: bool,
117+
is_method_access_with_parens: bool,
118118
) {
119119
let mut seen_names = FxHashSet::default();
120120
for receiver in receiver.autoderef(ctx.db) {
121121
for (field, ty) in receiver.fields(ctx.db) {
122122
if seen_names.insert(field.name(ctx.db))
123123
&& (is_field_access
124-
|| (is_method_acess_with_parens && (ty.is_fn() || ty.is_closure())))
124+
|| (is_method_access_with_parens && (ty.is_fn() || ty.is_closure())))
125125
{
126126
named_field(acc, field, ty);
127127
}
@@ -131,7 +131,7 @@ fn complete_fields(
131131
// already seen without inserting into the hashset.
132132
if !seen_names.contains(&hir::Name::new_tuple_field(i))
133133
&& (is_field_access
134-
|| (is_method_acess_with_parens && (ty.is_fn() || ty.is_closure())))
134+
|| (is_method_access_with_parens && (ty.is_fn() || ty.is_closure())))
135135
{
136136
// Tuple fields are always public (tuple struct fields are handled above).
137137
tuple_index(acc, i, ty);

crates/ide-completion/src/tests/expression.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn func(param0 @ (param1, param2): (i32, i32)) {
105105
fn completes_all_the_things_in_fn_body() {
106106
check(
107107
r#"
108-
use non_existant::Unresolved;
108+
use non_existent::Unresolved;
109109
mod qualified { pub enum Enum { Variant } }
110110
111111
impl Unit {
@@ -170,7 +170,7 @@ impl Unit {
170170
);
171171
check(
172172
r#"
173-
use non_existant::Unresolved;
173+
use non_existent::Unresolved;
174174
mod qualified { pub enum Enum { Variant } }
175175
176176
impl Unit {

crates/ide-db/src/documentation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Documentation attribute related utilties.
1+
//! Documentation attribute related utilities.
22
use either::Either;
33
use hir::{
44
db::{DefDatabase, HirDatabase},

crates/ide-diagnostics/src/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fn minicore_smoke_test() {
173173
fn check(minicore: MiniCore) {
174174
let source = minicore.source_code();
175175
let mut config = DiagnosticsConfig::test_sample();
176-
// This should be ignored since we conditionaly remove code which creates single item use with braces
176+
// This should be ignored since we conditionally remove code which creates single item use with braces
177177
config.disabled.insert("unused_braces".to_string());
178178
check_diagnostics_with_config(config, &source);
179179
}

crates/ide/src/inlay_hints/implicit_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mod tests {
177177

178178
#[test]
179179
fn try_operator() {
180-
// We currently show drop inlay hint for every `?` operator that may potentialy drop something. We probably need to
180+
// We currently show drop inlay hint for every `?` operator that may potentially drop something. We probably need to
181181
// make it configurable as it doesn't seem very useful.
182182
check_with_config(
183183
ONLY_DROP_CONFIG,

crates/mbe/src/expander/transcriber.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn expand_subtree<S: Span>(
292292
Err(e) => {
293293
// XXX: It *might* make sense to emit a dummy integer value like `0` here.
294294
// That would type inference a bit more robust in cases like
295-
// `v[${count(t)}]` where index doesn't matter, but also coult also lead to
295+
// `v[${count(t)}]` where index doesn't matter, but also could lead to
296296
// wrong infefrence for cases like `tup.${count(t)}` where index itself
297297
// does matter.
298298
if err.is_none() {

crates/proc-macro-srv/src/server/rust_analyzer_span.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! proc-macro server backend based on rust-analyzer's internal span represention
1+
//! proc-macro server backend based on rust-analyzer's internal span representation
22
//! This backend is used solely by rust-analyzer as it ties into rust-analyzer internals.
33
//!
44
//! It is an unfortunate result of how the proc-macro API works that we need to look into the

crates/rust-analyzer/src/cli/flags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ xflags::xflags! {
7171
optional --with-deps
7272
/// Don't load sysroot crates (`std`, `core` & friends).
7373
optional --no-sysroot
74-
/// Run cargo metadata on the sysroot to analyze its third-pary dependencies.
74+
/// Run cargo metadata on the sysroot to analyze its third-party dependencies.
7575
/// Requires --no-sysroot to not be set.
7676
optional --query-sysroot-metadata
7777

crates/syntax/src/ast/edit_in_place.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,10 @@ impl ast::IdentPat {
965965
}
966966

967967
pub trait HasVisibilityEdit: ast::HasVisibility {
968-
fn set_visibility(&self, visbility: ast::Visibility) {
968+
fn set_visibility(&self, visibility: ast::Visibility) {
969969
match self.visibility() {
970970
Some(current_visibility) => {
971-
ted::replace(current_visibility.syntax(), visbility.syntax())
971+
ted::replace(current_visibility.syntax(), visibility.syntax())
972972
}
973973
None => {
974974
let vis_before = self
@@ -977,7 +977,7 @@ pub trait HasVisibilityEdit: ast::HasVisibility {
977977
.find(|it| !matches!(it.kind(), WHITESPACE | COMMENT | ATTR))
978978
.unwrap_or_else(|| self.syntax().first_child_or_token().unwrap());
979979

980-
ted::insert(ted::Position::before(vis_before), visbility.syntax());
980+
ted::insert(ted::Position::before(vis_before), visibility.syntax());
981981
}
982982
}
983983
}

crates/syntax/src/ast/node_ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl ast::UseTreeList {
384384
// the below remove the innermost {}, got `use crate::{{{A}}}`
385385
remove_brace_in_use_tree_list(&self);
386386

387-
// the below remove othe unnecessary {}, got `use crate::A`
387+
// the below remove other unnecessary {}, got `use crate::A`
388388
while let Some(parent_use_tree_list) = self.parent_use_tree().parent_use_tree_list() {
389389
remove_brace_in_use_tree_list(&parent_use_tree_list);
390390
self = parent_use_tree_list;

docs/dev/syntax.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Interior nodes are shared as well (for example in `(1 + 1) * (1 + 1)`).
128128
Note that, the result of the interning is an `Arc<Node>`.
129129
That is, it's not an index into interning table, so you don't have to have the table around to do anything with the tree.
130130
Each tree is fully self-contained (although different trees might share parts).
131-
Currently, the interner is created per-file, but it will be easy to use a per-thread or per-some-contex one.
131+
Currently, the interner is created per-file, but it will be easy to use a per-thread or per-some-context one.
132132

133133
We use a `TextSize`, a newtyped `u32`, to store the length of the text.
134134

lib/lsp-server/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl ProtocolError {
1414
ProtocolError("disconnected channel".into(), true)
1515
}
1616

17-
/// Whether this error occured due to a disconnected channel.
17+
/// Whether this error occurred due to a disconnected channel.
1818
pub fn channel_is_disconnected(&self) -> bool {
1919
self.1
2020
}

0 commit comments

Comments
 (0)