diff --git a/.github/actions/github-release/README.md b/.github/actions/github-release/README.md index 7b50d002001..c73a5040271 100644 --- a/.github/actions/github-release/README.md +++ b/.github/actions/github-release/README.md @@ -10,7 +10,7 @@ perform github releases but they all tend to have their set of drawbacks. Additionally nothing handles deleting releases which we need for our rolling `dev` release. -To handle all this this action rolls-its-own implementation using the +To handle all this action rolls-its-own implementation using the actions/toolkit repository and packages published there. These run in a Docker container and take various inputs to orchestrate the release from the build. diff --git a/.github/workflows/autopublish.yaml b/.github/workflows/autopublish.yaml index 279f86b458d..7090c94d93c 100644 --- a/.github/workflows/autopublish.yaml +++ b/.github/workflows/autopublish.yaml @@ -32,7 +32,7 @@ jobs: shell: bash run: | git config --global user.email "runner@gha.local" - git config --global user.name "Github Action" + git config --global user.name "GitHub Action" rm Cargo.lock # Fix names for crates that were published before switch to kebab-case. cargo workspaces rename --from base-db base_db diff --git a/.github/workflows/publish-libs.yaml b/.github/workflows/publish-libs.yaml index 1b843fff1a4..c043573cacf 100644 --- a/.github/workflows/publish-libs.yaml +++ b/.github/workflows/publish-libs.yaml @@ -29,7 +29,7 @@ jobs: shell: bash run: | git config --global user.email "runner@gha.local" - git config --global user.name "Github Action" + git config --global user.name "GitHub Action" # Remove r-a crates from the workspaces so we don't auto-publish them as well sed -i 's/ "crates\/\*"//' ./Cargo.toml cargo workspaces publish --yes --exact --from-git --no-git-commit --allow-dirty diff --git a/.vscode/launch.json b/.vscode/launch.json index 1e21214ffc4..c353737a35a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -72,7 +72,7 @@ }, { // Used for testing the extension with a local build of the LSP server (in `target/release`) - // with all other extendions loaded. + // with all other extensions loaded. "name": "Run With Extensions", "type": "extensionHost", "request": "launch", diff --git a/bench_data/glorious_old_parser b/bench_data/glorious_old_parser index 764893daa12..f593f2b2955 100644 --- a/bench_data/glorious_old_parser +++ b/bench_data/glorious_old_parser @@ -3808,7 +3808,7 @@ impl<'a> Parser<'a> { if self.eat_keyword(keywords::Else) || !cond.returns() { let sp = self.sess.source_map().next_point(lo); let mut err = self.diagnostic() - .struct_span_err(sp, "missing condition for `if` statemement"); + .struct_span_err(sp, "missing condition for `if` statement"); err.span_label(sp, "expected if condition here"); return Err(err) } diff --git a/crates/hir-def/src/find_path.rs b/crates/hir-def/src/find_path.rs index 3f439232083..30d6d019309 100644 --- a/crates/hir-def/src/find_path.rs +++ b/crates/hir-def/src/find_path.rs @@ -42,7 +42,7 @@ const MAX_PATH_LEN: usize = 15; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum PrefixKind { /// Causes paths to always start with either `self`, `super`, `crate` or a crate-name. - /// This is the same as plain, just that paths will start with `self` iprepended f the path + /// This is the same as plain, just that paths will start with `self` prepended if the path /// starts with an identifier that is not a crate. BySelf, /// Causes paths to ignore imports in the local module. diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs index 8709ad0e99b..1f4577629cc 100644 --- a/crates/hir-def/src/hir.rs +++ b/crates/hir-def/src/hir.rs @@ -502,7 +502,7 @@ impl Binding { pub fn is_upvar(&self, relative_to: ExprId) -> bool { match self.owner { Some(x) => { - // We assign expression ids in a way that outer closures will recieve + // We assign expression ids in a way that outer closures will receive // a lower id x.into_raw() < relative_to.into_raw() } diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs index 7a3e8c3b05c..216c6a45746 100644 --- a/crates/hir-def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs @@ -98,7 +98,7 @@ fn#19 main#20(#21)#21 {#22 ); } #[test] -fn float_field_acces_macro_input() { +fn float_field_access_macro_input() { check( r#" macro_rules! foo { diff --git a/crates/hir-def/src/nameres/proc_macro.rs b/crates/hir-def/src/nameres/proc_macro.rs index caad4a1f381..751b7beaac1 100644 --- a/crates/hir-def/src/nameres/proc_macro.rs +++ b/crates/hir-def/src/nameres/proc_macro.rs @@ -52,7 +52,7 @@ impl Attrs { } // This fn is intended for `#[proc_macro_derive(..)]` and `#[rustc_builtin_macro(..)]`, which have -// the same strucuture. +// the same structure. #[rustfmt::skip] pub(crate) fn parse_macro_name_and_helper_attrs(tt: &[TokenTree]) -> Option<(Name, Box<[Name]>)> { match tt { diff --git a/crates/hir-def/src/nameres/tests/mod_resolution.rs b/crates/hir-def/src/nameres/tests/mod_resolution.rs index a0193128847..81bc0ff91e3 100644 --- a/crates/hir-def/src/nameres/tests/mod_resolution.rs +++ b/crates/hir-def/src/nameres/tests/mod_resolution.rs @@ -887,7 +887,7 @@ mod module; //- /module.rs #![cfg(NEVER)] -struct AlsoShoulntAppear; +struct AlsoShouldNotAppear; "#, expect![[r#" crate diff --git a/crates/hir-expand/src/lib.rs b/crates/hir-expand/src/lib.rs index d26fdbf7d61..74797622fec 100644 --- a/crates/hir-expand/src/lib.rs +++ b/crates/hir-expand/src/lib.rs @@ -694,7 +694,7 @@ impl ExpansionInfo { (&attr_args.1, self.attr_input_or_mac_def.clone()?.syntax().cloned()) } MacroCallKind::Attr { attr_args, .. } => { - // try unshifting the the token id, if unshifting fails, the token resides in the non-item attribute input + // try unshifting the token id, if unshifting fails, the token resides in the non-item attribute input // note that the `TokenExpander::map_id_up` earlier only unshifts for declarative macros, so we don't double unshift with this match self.macro_arg_shift.unshift(token_id) { Some(unshifted) => { diff --git a/crates/hir-ty/src/diagnostics/expr.rs b/crates/hir-ty/src/diagnostics/expr.rs index d39e077b716..f346910da09 100644 --- a/crates/hir-ty/src/diagnostics/expr.rs +++ b/crates/hir-ty/src/diagnostics/expr.rs @@ -207,7 +207,7 @@ impl ExprValidator { let report = compute_match_usefulness(&cx, &m_arms, scrut_ty); - // FIXME Report unreacheble arms + // FIXME Report unreachable arms // https://github.com/rust-lang/rust/blob/f31622a50/compiler/rustc_mir_build/src/thir/pattern/check_match.rs#L200 let witnesses = report.non_exhaustiveness_witnesses; diff --git a/crates/hir-ty/src/diagnostics/match_check/deconstruct_pat.rs b/crates/hir-ty/src/diagnostics/match_check/deconstruct_pat.rs index b103fdc709d..7460f43387f 100644 --- a/crates/hir-ty/src/diagnostics/match_check/deconstruct_pat.rs +++ b/crates/hir-ty/src/diagnostics/match_check/deconstruct_pat.rs @@ -82,7 +82,7 @@ fn expand_or_pat(pat: &Pat) -> Vec<&Pat> { pats } -/// [Constructor] uses this in umimplemented variants. +/// [Constructor] uses this in unimplemented variants. /// It allows porting match expressions from upstream algorithm without losing semantics. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub(super) enum Void {} diff --git a/crates/hir-ty/src/diagnostics/match_check/pat_util.rs b/crates/hir-ty/src/diagnostics/match_check/pat_util.rs index b89b4f2bfb7..217454499ef 100644 --- a/crates/hir-ty/src/diagnostics/match_check/pat_util.rs +++ b/crates/hir-ty/src/diagnostics/match_check/pat_util.rs @@ -1,4 +1,4 @@ -//! Pattern untilities. +//! Pattern utilities. //! //! Originates from `rustc_hir::pat_util` diff --git a/crates/hir-ty/src/diagnostics/match_check/usefulness.rs b/crates/hir-ty/src/diagnostics/match_check/usefulness.rs index c4d709a975b..d737b24ad32 100644 --- a/crates/hir-ty/src/diagnostics/match_check/usefulness.rs +++ b/crates/hir-ty/src/diagnostics/match_check/usefulness.rs @@ -755,7 +755,7 @@ pub(crate) enum Reachability { /// The arm is reachable. This additionally carries a set of or-pattern branches that have been /// found to be unreachable despite the overall arm being reachable. Used only in the presence /// of or-patterns, otherwise it stays empty. - // FIXME: store ureachable subpattern IDs + // FIXME: store unreachable subpattern IDs Reachable, /// The arm is unreachable. Unreachable, diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs index d90ca77b55c..158cc289a01 100644 --- a/crates/hir-ty/src/infer.rs +++ b/crates/hir-ty/src/infer.rs @@ -483,7 +483,7 @@ pub(crate) struct InferenceContext<'a> { current_closure: Option, /// Stores the list of closure ids that need to be analyzed before this closure. See the /// comment on `InferenceContext::sort_closures` - closure_dependecies: FxHashMap>, + closure_dependencies: FxHashMap>, deferred_closures: FxHashMap, ExprId)>>, } @@ -555,7 +555,7 @@ impl<'a> InferenceContext<'a> { current_captures: vec![], current_closure: None, deferred_closures: FxHashMap::default(), - closure_dependecies: FxHashMap::default(), + closure_dependencies: FxHashMap::default(), } } diff --git a/crates/hir-ty/src/infer/closure.rs b/crates/hir-ty/src/infer/closure.rs index 28cb301f3e4..afacb8ef1c9 100644 --- a/crates/hir-ty/src/infer/closure.rs +++ b/crates/hir-ty/src/infer/closure.rs @@ -756,7 +756,7 @@ impl InferenceContext<'_> { let mut deferred_closures = mem::take(&mut self.deferred_closures); let mut dependents_count: FxHashMap = deferred_closures.keys().map(|x| (*x, 0)).collect(); - for (_, deps) in &self.closure_dependecies { + for (_, deps) in &self.closure_dependencies { for dep in deps { *dependents_count.entry(*dep).or_default() += 1; } @@ -768,7 +768,7 @@ impl InferenceContext<'_> { if let Some(d) = deferred_closures.remove(&x) { result.push((x, d)); } - for dep in self.closure_dependecies.get(&x).into_iter().flat_map(|x| x.iter()) { + for dep in self.closure_dependencies.get(&x).into_iter().flat_map(|x| x.iter()) { let cnt = dependents_count.get_mut(dep).unwrap(); *cnt -= 1; if *cnt == 0 { diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs index 64f37c761e9..2c37d25f54b 100644 --- a/crates/hir-ty/src/infer/expr.rs +++ b/crates/hir-ty/src/infer/expr.rs @@ -287,7 +287,7 @@ impl<'a> InferenceContext<'a> { .intern(Interner); self.deferred_closures.entry(closure_id).or_default(); if let Some(c) = self.current_closure { - self.closure_dependecies.entry(c).or_default().push(closure_id); + self.closure_dependencies.entry(c).or_default().push(closure_id); } (Some(closure_id), closure_ty, None) } @@ -349,7 +349,7 @@ impl<'a> InferenceContext<'a> { self.table.resolve_completely(callee_ty.clone()).kind(Interner) { if let Some(par) = self.current_closure { - self.closure_dependecies.entry(par).or_default().push(*c); + self.closure_dependencies.entry(par).or_default().push(*c); } self.deferred_closures.entry(*c).or_default().push(( derefed_callee.clone(), diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs index 50fe5a724d0..03536be8847 100644 --- a/crates/hir-ty/src/lib.rs +++ b/crates/hir-ty/src/lib.rs @@ -148,7 +148,7 @@ pub type Guidance = chalk_solve::Guidance; pub type WhereClause = chalk_ir::WhereClause; /// A constant can have reference to other things. Memory map job is holding -/// the neccessary bits of memory of the const eval session to keep the constant +/// the necessary bits of memory of the const eval session to keep the constant /// meaningful. #[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct MemoryMap(pub HashMap>); diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs index 2fa1bf2b7e6..d830ae263ba 100644 --- a/crates/hir-ty/src/mir.rs +++ b/crates/hir-ty/src/mir.rs @@ -55,7 +55,7 @@ pub struct Local { /// This is what is implemented in miri today. Are these the semantics we want for MIR? Is this /// something we can even decide without knowing more about Rust's memory model? /// -/// **Needs clarifiation:** Is loading a place that has its variant index set well-formed? Miri +/// **Needs clarification:** Is loading a place that has its variant index set well-formed? Miri /// currently implements it, but it seems like this may be something to check against in the /// validator. #[derive(Debug, PartialEq, Eq, Clone)] diff --git a/crates/hir-ty/src/mir/borrowck.rs b/crates/hir-ty/src/mir/borrowck.rs index 5b2bca955f5..016090d509b 100644 --- a/crates/hir-ty/src/mir/borrowck.rs +++ b/crates/hir-ty/src/mir/borrowck.rs @@ -110,7 +110,7 @@ fn place_case(lvalue: &Place) -> ProjectionCase { /// Returns a map from basic blocks to the set of locals that might be ever initialized before /// the start of the block. Only `StorageDead` can remove something from this map, and we ignore -/// `Uninit` and `drop` and similars after initialization. +/// `Uninit` and `drop` and similar after initialization. fn ever_initialized_map(body: &MirBody) -> ArenaMap> { let mut result: ArenaMap> = body.basic_blocks.iter().map(|x| (x.0, ArenaMap::default())).collect(); diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs index 8c911b7f7b7..7b01cc39dd1 100644 --- a/crates/hir-ty/src/mir/eval.rs +++ b/crates/hir-ty/src/mir/eval.rs @@ -123,7 +123,7 @@ impl Interval { } fn write_from_interval(&self, memory: &mut Evaluator<'_>, interval: Interval) -> Result<()> { - // FIXME: this could be more efficent + // FIXME: this could be more efficient let bytes = &interval.get(memory)?.to_vec(); memory.write_memory(self.addr, bytes) } @@ -692,7 +692,7 @@ impl Evaluator<'_> { Owned(r[0..lc.len()].into()) } BinOp::Shl | BinOp::Shr => { - let shift_amout = if r128 < 0 { + let shift_amount = if r128 < 0 { return Err(MirEvalError::Panic(format!("Overflow in {op:?}"))); } else if r128 > 128 { return Err(MirEvalError::Panic(format!("Overflow in {op:?}"))); @@ -700,8 +700,8 @@ impl Evaluator<'_> { r128 as u8 }; let r = match op { - BinOp::Shl => l128 << shift_amout, - BinOp::Shr => l128 >> shift_amout, + BinOp::Shl => l128 << shift_amount, + BinOp::Shr => l128 >> shift_amount, _ => unreachable!(), }; Owned(r.to_le_bytes()[0..lc.len()].into()) @@ -966,7 +966,7 @@ impl Evaluator<'_> { fn make_by_layout( &mut self, - size: usize, // Not neccessarily equal to variant_layout.size + size: usize, // Not necessarily equal to variant_layout.size variant_layout: &Layout, tag: Option<(usize, usize, i128)>, values: impl Iterator, @@ -1481,7 +1481,7 @@ impl Evaluator<'_> { is_dyn_method(self.db, self.trait_env.clone(), def, generic_args.clone()) { // In the layout of current possible receiver, which at the moment of writing this code is one of - // `&T`, `&mut T`, `Box`, `Rc`, `Arc`, and `Pin

` where `P` is one of possible recievers, + // `&T`, `&mut T`, `Box`, `Rc`, `Arc`, and `Pin

` where `P` is one of possible receivers, // the vtable is exactly in the `[ptr_size..2*ptr_size]` bytes. So we can use it without branching on // the type. let ty = self diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs index 78a2d90f7fb..da5d1aff0a0 100644 --- a/crates/hir-ty/src/mir/lower.rs +++ b/crates/hir-ty/src/mir/lower.rs @@ -1206,7 +1206,7 @@ impl<'ctx> MirLowerCtx<'ctx> { ); let prev_label = if let Some(label) = label { // We should generate the end now, to make sure that it wouldn't change later. It is - // bad as we may emit end (unneccessary unreachable block) for unterminating loop, but + // bad as we may emit end (unnecessary unreachable block) for unterminating loop, but // it should not affect correctness. self.current_loop_end()?; self.labeled_loop_blocks @@ -1278,7 +1278,7 @@ impl<'ctx> MirLowerCtx<'ctx> { /// the appropriated places. fn push_storage_live(&mut self, b: BindingId, current: BasicBlockId) -> Result<()> { // Current implementation is wrong. It adds no `StorageDead` at the end of scope, and before each break - // and continue. It just add a `StorageDead` before the `StorageLive`, which is not wrong, but unneeeded in + // and continue. It just add a `StorageDead` before the `StorageLive`, which is not wrong, but unneeded in // the proper implementation. Due this limitation, implementing a borrow checker on top of this mir will falsely // allow this: // diff --git a/crates/hir-ty/src/mir/lower/pattern_matching.rs b/crates/hir-ty/src/mir/lower/pattern_matching.rs index 12a77715e9c..a5b48b6b936 100644 --- a/crates/hir-ty/src/mir/lower/pattern_matching.rs +++ b/crates/hir-ty/src/mir/lower/pattern_matching.rs @@ -23,7 +23,7 @@ impl MirLowerCtx<'_> { /// mismatched path block is `None`. /// /// By default, it will create a new block for mismatched path. If you already have one, you can provide it with - /// `current_else` argument to save an unneccessary jump. If `current_else` isn't `None`, the result mismatched path + /// `current_else` argument to save an unnecessary jump. If `current_else` isn't `None`, the result mismatched path /// wouldn't be `None` as well. Note that this function will add jumps to the beginning of the `current_else` block, /// so it should be an empty block. pub(super) fn pattern_match( diff --git a/crates/hir-ty/src/tests/regression.rs b/crates/hir-ty/src/tests/regression.rs index 28b87689ecd..4af143829f3 100644 --- a/crates/hir-ty/src/tests/regression.rs +++ b/crates/hir-ty/src/tests/regression.rs @@ -1060,7 +1060,7 @@ fn infix_parse(_state: S, _level_code: &Fn(S)) -> T { loop {} } -fn parse_arule() { +fn parse_a_rule() { infix_parse((), &(|_recurse| ())) } "#, diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index fdfae44c2d1..857891a2148 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -4250,7 +4250,7 @@ impl Trait for () { } #[test] -fn associted_type_in_struct_expr_path_enum() { +fn associated_type_in_struct_expr_path_enum() { // FIXME: All annotation should be resolvable. // For lines marked as unstable, see rust-lang/rust#86935. // FIXME: Remove the comments once stablized. diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index db923cb0fe2..0d1bf9be5a7 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -801,7 +801,7 @@ fn precise_macro_call_location( ast: &MacroCallKind, db: &dyn HirDatabase, ) -> (InFile, Option, Option, MacroKind) { - // FIXME: maaybe we actually want slightly different ranges for the different macro diagnostics + // FIXME: maybe we actually want slightly different ranges for the different macro diagnostics // - e.g. the full attribute for macro errors, but only the name for name resolution match ast { MacroCallKind::FnLike { ast_id, .. } => { @@ -1522,7 +1522,7 @@ impl DefWithBody { match source_map.expr_syntax(expr) { Ok(expr) => acc.push(MissingUnsafe { expr }.into()), Err(SyntheticSyntax) => { - // FIXME: Here and eslwhere in this file, the `expr` was + // FIXME: Here and elsewhere in this file, the `expr` was // desugared, report or assert that this doesn't happen. } } @@ -3654,7 +3654,7 @@ impl Type { self.as_adt() .and_then(|a| a.lifetime(db).and_then(|lt| Some((<.name).to_smol_str()))) .into_iter() - // add the type and const paramaters + // add the type and const parameters .chain(self.type_and_const_arguments(db)) } diff --git a/crates/ide-assists/src/handlers/add_missing_impl_members.rs b/crates/ide-assists/src/handlers/add_missing_impl_members.rs index 4e11b31deb0..9e4e6c1daf7 100644 --- a/crates/ide-assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ide-assists/src/handlers/add_missing_impl_members.rs @@ -252,7 +252,7 @@ impl Foo for S { } #[test] - fn test_copied_overriden_members() { + fn test_copied_overridden_members() { check_assist( add_missing_impl_members, r#" diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs index 698ad78cce6..17ffb861fdd 100644 --- a/crates/ide-assists/src/handlers/auto_import.rs +++ b/crates/ide-assists/src/handlers/auto_import.rs @@ -203,7 +203,7 @@ fn relevance_score( // get the distance between the imported path and the current module // (prefer items that are more local) Some((item_module, current_module)) => { - score -= module_distance_hueristic(db, current_module, &item_module) as i32; + score -= module_distance_heuristic(db, current_module, &item_module) as i32; } // could not find relevant modules, so just use the length of the path as an estimate @@ -214,7 +214,7 @@ fn relevance_score( } /// A heuristic that gives a higher score to modules that are more separated. -fn module_distance_hueristic(db: &dyn HirDatabase, current: &Module, item: &Module) -> usize { +fn module_distance_heuristic(db: &dyn HirDatabase, current: &Module, item: &Module) -> usize { // get the path starting from the item to the respective crate roots let mut current_path = current.path_to_root(db); let mut item_path = item.path_to_root(db); diff --git a/crates/ide-assists/src/handlers/convert_to_guarded_return.rs b/crates/ide-assists/src/handlers/convert_to_guarded_return.rs index b97be34c5f7..dcb96ab8af4 100644 --- a/crates/ide-assists/src/handlers/convert_to_guarded_return.rs +++ b/crates/ide-assists/src/handlers/convert_to_guarded_return.rs @@ -504,7 +504,7 @@ fn main() { } #[test] - fn ignore_statements_aftert_if() { + fn ignore_statements_after_if() { check_assist_not_applicable( convert_to_guarded_return, r#" diff --git a/crates/ide-assists/src/handlers/extract_function.rs b/crates/ide-assists/src/handlers/extract_function.rs index 728018506d1..58605f7ed57 100644 --- a/crates/ide-assists/src/handlers/extract_function.rs +++ b/crates/ide-assists/src/handlers/extract_function.rs @@ -374,7 +374,7 @@ struct OutlivedLocal { /// Container of local variable usages /// -/// Semanticall same as `UsageSearchResult`, but provides more convenient interface +/// Semantically same as `UsageSearchResult`, but provides more convenient interface struct LocalUsages(ide_db::search::UsageSearchResult); impl LocalUsages { @@ -1291,8 +1291,8 @@ fn find_non_trait_impl(trait_impl: &SyntaxNode) -> Option { let as_impl = ast::Impl::cast(trait_impl.clone())?; let impl_type = Some(impl_type_name(&as_impl)?); - let sibblings = trait_impl.parent()?.children(); - sibblings + let siblings = trait_impl.parent()?.children(); + siblings .filter_map(ast::Impl::cast) .find(|s| impl_type_name(s) == impl_type && !is_trait_impl(s)) } diff --git a/crates/ide-assists/src/handlers/extract_module.rs b/crates/ide-assists/src/handlers/extract_module.rs index 0fa7bd558bb..795691d73ed 100644 --- a/crates/ide-assists/src/handlers/extract_module.rs +++ b/crates/ide-assists/src/handlers/extract_module.rs @@ -357,7 +357,7 @@ impl Module { fn change_visibility(&mut self, record_fields: Vec) { let (mut replacements, record_field_parents, impls) = - get_replacements_for_visibilty_change(&mut self.body_items, false); + get_replacements_for_visibility_change(&mut self.body_items, false); let mut impl_items: Vec = impls .into_iter() @@ -366,7 +366,7 @@ impl Module { .collect(); let (mut impl_item_replacements, _, _) = - get_replacements_for_visibilty_change(&mut impl_items, true); + get_replacements_for_visibility_change(&mut impl_items, true); replacements.append(&mut impl_item_replacements); @@ -824,7 +824,7 @@ fn does_source_exists_outside_sel_in_same_mod( source_exists_outside_sel_in_same_mod } -fn get_replacements_for_visibilty_change( +fn get_replacements_for_visibility_change( items: &mut [ast::Item], is_clone_for_updated: bool, ) -> ( @@ -1236,7 +1236,8 @@ mod modname { } #[test] - fn test_extract_module_for_correspoding_adt_of_impl_present_in_same_mod_but_not_in_selection() { + fn test_extract_module_for_corresponding_adt_of_impl_present_in_same_mod_but_not_in_selection() + { check_assist( extract_module, r" diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs index 49debafe1a0..f75df287867 100644 --- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs @@ -1006,7 +1006,7 @@ enum X<'a, 'b, 'x> { } #[test] - fn test_extract_struct_with_liftime_type_const() { + fn test_extract_struct_with_lifetime_type_const() { check_assist( extract_struct_from_enum_variant, r#" diff --git a/crates/ide-assists/src/handlers/generate_documentation_template.rs b/crates/ide-assists/src/handlers/generate_documentation_template.rs index b8415c72a2a..e87132218ea 100644 --- a/crates/ide-assists/src/handlers/generate_documentation_template.rs +++ b/crates/ide-assists/src/handlers/generate_documentation_template.rs @@ -324,7 +324,7 @@ fn self_name(ast_func: &ast::Fn) -> Option { self_partial_type(ast_func).map(|name| to_lower_snake_case(&name)) } -/// Heper function to get the name of the type of `self` +/// Helper function to get the name of the type of `self` fn self_type(ast_func: &ast::Fn) -> Option { ast_func.syntax().ancestors().find_map(ast::Impl::cast).and_then(|i| i.self_ty()) } @@ -350,7 +350,7 @@ fn self_type_without_lifetimes(ast_func: &ast::Fn) -> Option { Some(name) } -/// Heper function to get the name of the type of `self` without generic arguments +/// Helper function to get the name of the type of `self` without generic arguments fn self_partial_type(ast_func: &ast::Fn) -> Option { let mut self_type = self_type(ast_func)?.to_string(); if let Some(idx) = self_type.find(|c| ['<', ' '].contains(&c)) { diff --git a/crates/ide-assists/src/handlers/generate_function.rs b/crates/ide-assists/src/handlers/generate_function.rs index a5556878be6..739b466b311 100644 --- a/crates/ide-assists/src/handlers/generate_function.rs +++ b/crates/ide-assists/src/handlers/generate_function.rs @@ -893,14 +893,14 @@ fn filter_bounds_in_scope( let target_impl = target.parent().ancestors().find_map(ast::Impl::cast)?; let target_impl = ctx.sema.to_def(&target_impl)?; // It's sufficient to test only the first element of `generic_params` because of the order of - // insertion (see `relevant_parmas_and_where_clauses()`). + // insertion (see `params_and_where_preds_in_scope()`). let def = generic_params.first()?.self_ty_param.parent(); if def != hir::GenericDef::Impl(target_impl) { return None; } // Now we know every element that belongs to an impl would be in scope at `target`, we can - // filter them out just by lookint at their parent. + // filter them out just by looking at their parent. generic_params.retain(|it| !matches!(it.self_ty_param.parent(), hir::GenericDef::Impl(_))); where_preds.retain(|it| { it.node.syntax().parent().and_then(|it| it.parent()).and_then(ast::Impl::cast).is_none() @@ -1087,7 +1087,7 @@ fn calculate_necessary_visibility( } } -// This is never intended to be used as a generic graph strucuture. If there's ever another need of +// This is never intended to be used as a generic graph structure. If there's ever another need of // graph algorithm, consider adding a library for that (and replace the following). /// Minimally implemented directed graph structure represented by adjacency list. struct Graph { @@ -2380,7 +2380,7 @@ mod s { } #[test] - fn create_method_with_cursor_anywhere_on_call_expresion() { + fn create_method_with_cursor_anywhere_on_call_expression() { check_assist( generate_function, r" @@ -2487,7 +2487,7 @@ fn foo() {s::S::bar();} } #[test] - fn create_static_method_with_cursor_anywhere_on_call_expresion() { + fn create_static_method_with_cursor_anywhere_on_call_expression() { check_assist( generate_function, r" diff --git a/crates/ide-assists/src/handlers/generate_getter.rs b/crates/ide-assists/src/handlers/generate_getter.rs index 4595cfe29c8..dd6bbd84afc 100644 --- a/crates/ide-assists/src/handlers/generate_getter.rs +++ b/crates/ide-assists/src/handlers/generate_getter.rs @@ -174,7 +174,7 @@ pub(crate) fn generate_getter_impl( // this buf inserts a newline at the end of a getter // automatically, if one wants to add one more newline // for separating it from other assoc items, that needs - // to be handled spearately + // to be handled separately let mut getter_buf = generate_getter_from_info(ctx, &getter_info, record_field_info); diff --git a/crates/ide-assists/src/handlers/generate_new.rs b/crates/ide-assists/src/handlers/generate_new.rs index e30a3e942c4..824255e4f8e 100644 --- a/crates/ide-assists/src/handlers/generate_new.rs +++ b/crates/ide-assists/src/handlers/generate_new.rs @@ -98,9 +98,9 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option .fields() .enumerate() .filter_map(|(i, f)| { - let contructor = trivial_constructors[i].clone(); - if contructor.is_some() { - contructor + let constructor = trivial_constructors[i].clone(); + if constructor.is_some() { + constructor } else { Some(f.name()?.to_string()) } diff --git a/crates/ide-assists/src/handlers/inline_macro.rs b/crates/ide-assists/src/handlers/inline_macro.rs index 626f2060b23..5aa8e56f562 100644 --- a/crates/ide-assists/src/handlers/inline_macro.rs +++ b/crates/ide-assists/src/handlers/inline_macro.rs @@ -148,7 +148,7 @@ macro_rules! num { #[test] fn inline_macro_simple_not_applicable_broken_macro() { // FIXME: This is a bug. The macro should not expand, but it's - // the same behaviour as the "Expand Macro Recursively" commmand + // the same behaviour as the "Expand Macro Recursively" command // so it's presumably OK for the time being. check_assist( inline_macro, diff --git a/crates/ide-assists/src/handlers/introduce_named_lifetime.rs b/crates/ide-assists/src/handlers/introduce_named_lifetime.rs index a54dc4f96de..c5aa9755bc0 100644 --- a/crates/ide-assists/src/handlers/introduce_named_lifetime.rs +++ b/crates/ide-assists/src/handlers/introduce_named_lifetime.rs @@ -66,7 +66,7 @@ fn generate_fn_def_assist( // if we have a self reference, use that Some(NeedsLifetime::SelfParam(self_param)) } else { - // otherwise, if there's a single reference parameter without a named liftime, use that + // otherwise, if there's a single reference parameter without a named lifetime, use that let fn_params_without_lifetime: Vec<_> = param_list .params() .filter_map(|param| match param.ty() { @@ -79,7 +79,7 @@ fn generate_fn_def_assist( match fn_params_without_lifetime.len() { 1 => Some(fn_params_without_lifetime.into_iter().next()?), 0 => None, - // multiple unnnamed is invalid. assist is not applicable + // multiple unnamed is invalid. assist is not applicable _ => return None, } }; diff --git a/crates/ide-assists/src/handlers/pull_assignment_up.rs b/crates/ide-assists/src/handlers/pull_assignment_up.rs index 4cfe6c99b23..a5c7fea403d 100644 --- a/crates/ide-assists/src/handlers/pull_assignment_up.rs +++ b/crates/ide-assists/src/handlers/pull_assignment_up.rs @@ -386,7 +386,7 @@ fn foo() { } #[test] - fn pull_assignment_up_if_missing_assigment_not_applicable() { + fn pull_assignment_up_if_missing_assignment_not_applicable() { check_assist_not_applicable( pull_assignment_up, r#" @@ -401,7 +401,7 @@ fn foo() { } #[test] - fn pull_assignment_up_match_missing_assigment_not_applicable() { + fn pull_assignment_up_match_missing_assignment_not_applicable() { check_assist_not_applicable( pull_assignment_up, r#" diff --git a/crates/ide-assists/src/handlers/qualify_method_call.rs b/crates/ide-assists/src/handlers/qualify_method_call.rs index e7014597a1d..4bf974a5655 100644 --- a/crates/ide-assists/src/handlers/qualify_method_call.rs +++ b/crates/ide-assists/src/handlers/qualify_method_call.rs @@ -507,7 +507,7 @@ fn main() { } #[test] - fn struct_method_over_stuct_instance() { + fn struct_method_over_struct_instance() { check_assist_not_applicable( qualify_method_call, r#" @@ -525,7 +525,7 @@ fn main() { } #[test] - fn trait_method_over_stuct_instance() { + fn trait_method_over_struct_instance() { check_assist_not_applicable( qualify_method_call, r#" diff --git a/crates/ide-assists/src/handlers/remove_parentheses.rs b/crates/ide-assists/src/handlers/remove_parentheses.rs index e9c7c6bae9c..ffc32f80499 100644 --- a/crates/ide-assists/src/handlers/remove_parentheses.rs +++ b/crates/ide-assists/src/handlers/remove_parentheses.rs @@ -124,7 +124,7 @@ mod tests { } #[test] - fn remove_parens_doesnt_apply_weird_syntax_and_adge_cases() { + fn remove_parens_doesnt_apply_weird_syntax_and_edge_cases() { // removing `()` would break code because {} would be counted as the loop/if body check_assist_not_applicable(remove_parentheses, r#"fn f() { for _ in $0(0..{3}) {} }"#); check_assist_not_applicable(remove_parentheses, r#"fn f() { for _ in $0(S {}) {} }"#); diff --git a/crates/ide-assists/src/handlers/remove_unused_param.rs b/crates/ide-assists/src/handlers/remove_unused_param.rs index bd2e8fbe389..0772b168d49 100644 --- a/crates/ide-assists/src/handlers/remove_unused_param.rs +++ b/crates/ide-assists/src/handlers/remove_unused_param.rs @@ -232,7 +232,7 @@ fn b() { foo( ) } } #[test] - fn remove_unused_surrounded_by_parms() { + fn remove_unused_surrounded_by_params() { check_assist( remove_unused_param, r#" diff --git a/crates/ide-assists/src/handlers/replace_string_with_char.rs b/crates/ide-assists/src/handlers/replace_string_with_char.rs index decb5fb62a7..6310981ccce 100644 --- a/crates/ide-assists/src/handlers/replace_string_with_char.rs +++ b/crates/ide-assists/src/handlers/replace_string_with_char.rs @@ -31,14 +31,14 @@ pub(crate) fn replace_string_with_char(acc: &mut Assists, ctx: &AssistContext<'_ if value.chars().take(2).count() != 1 { return None; } - let quote_offets = token.quote_offsets()?; + let quote_offsets = token.quote_offsets()?; acc.add( AssistId("replace_string_with_char", AssistKind::RefactorRewrite), "Replace string with char", target, |edit| { - let (left, right) = quote_offets.quotes; + let (left, right) = quote_offsets.quotes; edit.replace(left, '\''); edit.replace(right, '\''); if value == "'" { diff --git a/crates/ide-completion/src/context/analysis.rs b/crates/ide-completion/src/context/analysis.rs index a94c404586b..94787abf73b 100644 --- a/crates/ide-completion/src/context/analysis.rs +++ b/crates/ide-completion/src/context/analysis.rs @@ -609,14 +609,14 @@ fn classify_name_ref( _ => false, }; - let reciever_is_part_of_indivisible_expression = match &receiver { + let receiver_is_part_of_indivisible_expression = match &receiver { Some(ast::Expr::IfExpr(_)) => { let next_token_kind = next_non_trivia_token(name_ref.syntax().clone()).map(|t| t.kind()); next_token_kind == Some(SyntaxKind::ELSE_KW) }, _ => false }; - if reciever_is_part_of_indivisible_expression { + if receiver_is_part_of_indivisible_expression { return None; } diff --git a/crates/ide-completion/src/lib.rs b/crates/ide-completion/src/lib.rs index a06b7e95778..a88798563de 100644 --- a/crates/ide-completion/src/lib.rs +++ b/crates/ide-completion/src/lib.rs @@ -133,7 +133,7 @@ pub use crate::{ /// /// Another case where this would be instrumental is macro expansion. We want to /// insert a fake ident and re-expand code. There's `expand_speculative` as a -/// work-around for this. +/// workaround for this. /// /// A different use-case is completion of injection (examples and links in doc /// comments). When computing completion for a path in a doc-comment, you want diff --git a/crates/ide-completion/src/render/macro_.rs b/crates/ide-completion/src/render/macro_.rs index 44e88607633..ce7af1d3400 100644 --- a/crates/ide-completion/src/render/macro_.rs +++ b/crates/ide-completion/src/render/macro_.rs @@ -74,7 +74,7 @@ fn render( item.insert_text(banged_name(&escaped_name)).lookup_by(banged_name(&name)); } _ => { - cov_mark::hit!(dont_insert_macro_call_parens_unncessary); + cov_mark::hit!(dont_insert_macro_call_parens_unnecessary); item.insert_text(escaped_name); } }; @@ -140,8 +140,8 @@ mod tests { use crate::tests::check_edit; #[test] - fn dont_insert_macro_call_parens_unncessary() { - cov_mark::check!(dont_insert_macro_call_parens_unncessary); + fn dont_insert_macro_call_parens_unnecessary() { + cov_mark::check!(dont_insert_macro_call_parens_unnecessary); check_edit( "frobnicate", r#" diff --git a/crates/ide-completion/src/tests.rs b/crates/ide-completion/src/tests.rs index 79c1f98f3bd..ef4c939fe64 100644 --- a/crates/ide-completion/src/tests.rs +++ b/crates/ide-completion/src/tests.rs @@ -105,7 +105,7 @@ fn completion_list_with_config( include_keywords: bool, trigger_character: Option, ) -> String { - // filter out all but one builtintype completion for smaller test outputs + // filter out all but one built-in type completion for smaller test outputs let items = get_all_items(config, ra_fixture, trigger_character); let items = items .into_iter() diff --git a/crates/ide-completion/src/tests/expression.rs b/crates/ide-completion/src/tests/expression.rs index 36465be23d8..be5b7f8a340 100644 --- a/crates/ide-completion/src/tests/expression.rs +++ b/crates/ide-completion/src/tests/expression.rs @@ -667,7 +667,7 @@ fn main() { } #[test] -fn varaiant_with_struct() { +fn variant_with_struct() { check_empty( r#" pub struct YoloVariant { diff --git a/crates/ide-completion/src/tests/proc_macros.rs b/crates/ide-completion/src/tests/proc_macros.rs index 92ea4d15b85..2d6234e310c 100644 --- a/crates/ide-completion/src/tests/proc_macros.rs +++ b/crates/ide-completion/src/tests/proc_macros.rs @@ -81,7 +81,7 @@ impl Foo { } #[proc_macros::input_replace( - fn suprise() { + fn surprise() { Foo.$0 } )] @@ -114,7 +114,7 @@ impl Foo { } #[proc_macros::input_replace( - fn suprise() { + fn surprise() { Foo.f$0 } )] diff --git a/crates/ide-db/src/assists.rs b/crates/ide-db/src/assists.rs index 8c6c1c44aa7..7a7328f312d 100644 --- a/crates/ide-db/src/assists.rs +++ b/crates/ide-db/src/assists.rs @@ -98,7 +98,7 @@ impl FromStr for AssistKind { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct AssistId(pub &'static str, pub AssistKind); -/// A way to control how many asssist to resolve during the assist resolution. +/// A way to control how many assist to resolve during the assist resolution. /// When an assist is resolved, its edits are calculated that might be costly to always do by default. #[derive(Debug)] pub enum AssistResolveStrategy { diff --git a/crates/ide-db/src/generated/lints.rs b/crates/ide-db/src/generated/lints.rs index f0c3690962a..e488300b41c 100644 --- a/crates/ide-db/src/generated/lints.rs +++ b/crates/ide-db/src/generated/lints.rs @@ -4230,7 +4230,7 @@ pub union GenericUnion { // Unions with non-`Copy` fields are unstable. pub const THIS_IS_OKAY: GenericUnion<()> = GenericUnion { field: () }; ``` -Like transarent `struct`s, a transparent `union` of type `U` has the same +Like transparent `struct`s, a transparent `union` of type `U` has the same layout, size, and ABI as its single non-ZST field. If it is generic over a type `T`, and all its fields are ZSTs except for exactly one field of type `T`, then it has the same layout and ABI as `T` (even if `T` is a ZST when monomorphized). @@ -6548,7 +6548,7 @@ subtracting elements in an Add impl."##, }, Lint { label: "clippy::suspicious_assignment_formatting", - description: r##"Checks for use of the non-existent `=*`, `=!` and `=-` + description: r##"Checks for use of the nonexistent `=*`, `=!` and `=-` operators."##, }, Lint { diff --git a/crates/ide-db/src/source_change.rs b/crates/ide-db/src/source_change.rs index 04e62a8e916..5a3e352b2ec 100644 --- a/crates/ide-db/src/source_change.rs +++ b/crates/ide-db/src/source_change.rs @@ -181,7 +181,7 @@ impl SourceChangeBuilder { /// mutability, and different nodes in the same tree see the same mutations. /// /// The typical pattern for an assist is to find specific nodes in the read - /// phase, and then get their mutable couterparts using `make_mut` in the + /// phase, and then get their mutable counterparts using `make_mut` in the /// mutable state. pub fn make_syntax_mut(&mut self, node: SyntaxNode) -> SyntaxNode { self.mutated_tree.get_or_insert_with(|| TreeMutator::new(&node)).make_syntax_mut(&node) diff --git a/crates/ide-db/src/syntax_helpers/format_string.rs b/crates/ide-db/src/syntax_helpers/format_string.rs index 2d6927cee99..acf0a67de4a 100644 --- a/crates/ide-db/src/syntax_helpers/format_string.rs +++ b/crates/ide-db/src/syntax_helpers/format_string.rs @@ -92,7 +92,7 @@ pub fn lex_format_specifiers( let (_, second) = cloned.next().unwrap_or_default(); match second { '<' | '^' | '>' => { - // alignment specifier, first char specifies fillment + // alignment specifier, first char specifies fill skip_char_and_emit(&mut chars, FormatSpecifier::Fill, &mut callback); skip_char_and_emit(&mut chars, FormatSpecifier::Align, &mut callback); } diff --git a/crates/ide-db/src/syntax_helpers/format_string_exprs.rs b/crates/ide-db/src/syntax_helpers/format_string_exprs.rs index fcef71fb74e..fc230818193 100644 --- a/crates/ide-db/src/syntax_helpers/format_string_exprs.rs +++ b/crates/ide-db/src/syntax_helpers/format_string_exprs.rs @@ -1,7 +1,7 @@ //! Tools to work with expressions present in format string literals for the `format_args!` family of macros. //! Primarily meant for assists and completions. -/// Enum for represenging extraced format string args. +/// Enum for representing extracted format string args. /// Can either be extracted expressions (which includes identifiers), /// or placeholders `{}`. #[derive(Debug, PartialEq, Eq)] diff --git a/crates/ide-db/src/use_trivial_constructor.rs b/crates/ide-db/src/use_trivial_constructor.rs index 39431bed382..f96ea29ae2f 100644 --- a/crates/ide-db/src/use_trivial_constructor.rs +++ b/crates/ide-db/src/use_trivial_constructor.rs @@ -1,9 +1,9 @@ -//! Functionality for generating trivial contructors +//! Functionality for generating trivial constructors use hir::StructKind; use syntax::ast; -/// given a type return the trivial contructor (if one exists) +/// given a type return the trivial constructor (if one exists) pub fn use_trivial_constructor( db: &crate::RootDatabase, path: ast::Path, diff --git a/crates/ide-diagnostics/src/handlers/incorrect_case.rs b/crates/ide-diagnostics/src/handlers/incorrect_case.rs index db88bf7b931..25ab0ca6f98 100644 --- a/crates/ide-diagnostics/src/handlers/incorrect_case.rs +++ b/crates/ide-diagnostics/src/handlers/incorrect_case.rs @@ -295,7 +295,7 @@ impl someStruct { } #[test] - fn no_diagnostic_for_enum_varinats() { + fn no_diagnostic_for_enum_variants() { check_diagnostics( r#" enum Option { Some, None } diff --git a/crates/ide-diagnostics/src/handlers/mutability_errors.rs b/crates/ide-diagnostics/src/handlers/mutability_errors.rs index 8c4ca23e06e..41ac83c0076 100644 --- a/crates/ide-diagnostics/src/handlers/mutability_errors.rs +++ b/crates/ide-diagnostics/src/handlers/mutability_errors.rs @@ -368,7 +368,7 @@ fn main() { #[test] fn mutation_in_dead_code() { // This one is interesting. Dead code is not represented at all in the MIR, so - // there would be no mutablility error for locals in dead code. Rustc tries to + // there would be no mutability error for locals in dead code. Rustc tries to // not emit `unused_mut` in this case, but since it works without `mut`, and // special casing it is not trivial, we emit it. check_diagnostics( @@ -773,7 +773,7 @@ fn fn_once(mut x: impl FnOnce(u8) -> u8) -> u8 { #[test] fn closure() { - // FIXME: Diagnositc spans are too large + // FIXME: Diagnostic spans are too large check_diagnostics( r#" //- minicore: copy, fn diff --git a/crates/ide-diagnostics/src/handlers/unresolved_field.rs b/crates/ide-diagnostics/src/handlers/unresolved_field.rs index cefa74e523e..c232381c1e9 100644 --- a/crates/ide-diagnostics/src/handlers/unresolved_field.rs +++ b/crates/ide-diagnostics/src/handlers/unresolved_field.rs @@ -45,7 +45,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::UnresolvedField) -> Option, expr_ptr: &InFile>, diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index a32ac35496a..b278924721c 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs @@ -219,7 +219,7 @@ mod tests { } #[test] - fn test_nagative_trait_bound() { + fn test_negative_trait_bound() { let txt = r#"impl !Unpin for Test {}"#; check( txt, diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index 79665b9eed5..2e5903c0602 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs @@ -66,7 +66,7 @@ pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(Fil (host.analysis(), FilePosition { file_id, offset }, annotations) } -/// Creates analysis from a multi-file fixture with annonations without $0 +/// Creates analysis from a multi-file fixture with annotations without $0 pub(crate) fn annotations_without_marker(ra_fixture: &str) -> (Analysis, Vec<(FileRange, String)>) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index 73ab3d2e16f..7294b625539 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -3115,7 +3115,7 @@ mod Foo$0 { } #[test] -fn hover_doc_outer_inner_attribue() { +fn hover_doc_outer_inner_attribute() { check( r#" #[doc = "Be quick;"] @@ -3146,7 +3146,7 @@ mod Foo$0 { } #[test] -fn hover_doc_block_style_indentend() { +fn hover_doc_block_style_indent_end() { check( r#" /** @@ -4288,7 +4288,7 @@ fn hover_builtin() { check( r#" //- /main.rs crate:main deps:std -cosnt _: &str$0 = ""; } +const _: &str$0 = ""; } //- /libstd.rs crate:std /// Docs for prim_str diff --git a/crates/ide/src/inlay_hints/adjustment.rs b/crates/ide/src/inlay_hints/adjustment.rs index fea4b89b89f..d5be0c5b883 100644 --- a/crates/ide/src/inlay_hints/adjustment.rs +++ b/crates/ide/src/inlay_hints/adjustment.rs @@ -148,7 +148,7 @@ pub(super) fn hints( Some(()) } -/// Returns whatever the hint should be postfix and if we need to add paretheses on the inside and/or outside of `expr`, +/// Returns whatever the hint should be postfix and if we need to add parentheses on the inside and/or outside of `expr`, /// if we are going to add (`postfix`) adjustments hints to it. fn mode_and_needs_parens_for_adjustment_hints( expr: &ast::Expr, @@ -183,7 +183,7 @@ fn mode_and_needs_parens_for_adjustment_hints( } } -/// Returns whatever we need to add paretheses on the inside and/or outside of `expr`, +/// Returns whatever we need to add parentheses on the inside and/or outside of `expr`, /// if we are going to add (`postfix`) adjustments hints to it. fn needs_parens_for_adjustment_hints(expr: &ast::Expr, postfix: bool) -> (bool, bool) { // This is a very miserable pile of hacks... @@ -194,10 +194,10 @@ fn needs_parens_for_adjustment_hints(expr: &ast::Expr, postfix: bool) -> (bool, // But we want to check what would happen if we add `*`/`.*` to the inner expression. // To check for inner we need `` expr.needs_parens_in(`*expr`) ``, // to check for outer we need `` `*expr`.needs_parens_in(parent) ``, - // where "expr" is the `expr` parameter, `*expr` is the editted `expr`, + // where "expr" is the `expr` parameter, `*expr` is the edited `expr`, // and "parent" is the parent of the original expression... // - // For this we utilize mutable mutable trees, which is a HACK, but it works. + // For this we utilize mutable trees, which is a HACK, but it works. // // FIXME: comeup with a better API for `needs_parens_in`, so that we don't have to do *this* @@ -243,7 +243,7 @@ fn needs_parens_for_adjustment_hints(expr: &ast::Expr, postfix: bool) -> (bool, }; // At this point - // - `parent` is the parrent of the original expression + // - `parent` is the parent of the original expression // - `dummy_expr` is the original expression wrapped in the operator we want (`*`/`.*`) // - `expr` is the clone of the original expression (with `dummy_expr` as the parent) diff --git a/crates/mbe/src/benchmark.rs b/crates/mbe/src/benchmark.rs index 894355fcbc9..141f77abb8b 100644 --- a/crates/mbe/src/benchmark.rs +++ b/crates/mbe/src/benchmark.rs @@ -108,7 +108,7 @@ fn invocation_fixtures(rules: &FxHashMap) -> Vec<(Stri } try_cnt += 1; if try_cnt > 100 { - panic!("invocaton fixture {name} cannot be generated.\n"); + panic!("invocation fixture {name} cannot be generated.\n"); } } } @@ -195,7 +195,7 @@ fn invocation_fixtures(rules: &FxHashMap) -> Vec<(Stri Op::Ignore { .. } | Op::Index { .. } => {} }; - // Simple linear congruential generator for determistic result + // Simple linear congruential generator for deterministic result fn rand(seed: &mut usize) -> usize { let a = 1664525; let c = 1013904223; diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index f4ea9e5c816..6fe8c005cf5 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs @@ -332,7 +332,7 @@ struct MatchState<'t> { /// Cached result of meta variable parsing meta_result: Option<(TtIter<'t>, ExpandResult>)>, - /// Is error occuried in this state, will `poised` to "parent" + /// Is error occurred in this state, will `poised` to "parent" is_error: bool, } diff --git a/crates/parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs index 7d0b156c5a0..5ae16475b65 100644 --- a/crates/parser/src/grammar/types.rs +++ b/crates/parser/src/grammar/types.rs @@ -59,7 +59,7 @@ pub(super) fn ascription(p: &mut Parser<'_>) { assert!(p.at(T![:])); p.bump(T![:]); if p.at(T![=]) { - // recover from `let x: = expr;`, `const X: = expr;` and similars + // recover from `let x: = expr;`, `const X: = expr;` and similar // hopefully no type starts with `=` p.error("missing type"); return; diff --git a/crates/parser/test_data/parser/err/0027_incomplere_where_for.rast b/crates/parser/test_data/parser/err/0027_incomplete_where_for.rast similarity index 100% rename from crates/parser/test_data/parser/err/0027_incomplere_where_for.rast rename to crates/parser/test_data/parser/err/0027_incomplete_where_for.rast diff --git a/crates/parser/test_data/parser/err/0027_incomplere_where_for.rs b/crates/parser/test_data/parser/err/0027_incomplete_where_for.rs similarity index 100% rename from crates/parser/test_data/parser/err/0027_incomplere_where_for.rs rename to crates/parser/test_data/parser/err/0027_incomplete_where_for.rs diff --git a/crates/parser/test_data/parser/err/0047_repated_extern_modifier.rast b/crates/parser/test_data/parser/err/0047_repeated_extern_modifier.rast similarity index 100% rename from crates/parser/test_data/parser/err/0047_repated_extern_modifier.rast rename to crates/parser/test_data/parser/err/0047_repeated_extern_modifier.rast diff --git a/crates/parser/test_data/parser/err/0047_repated_extern_modifier.rs b/crates/parser/test_data/parser/err/0047_repeated_extern_modifier.rs similarity index 100% rename from crates/parser/test_data/parser/err/0047_repated_extern_modifier.rs rename to crates/parser/test_data/parser/err/0047_repeated_extern_modifier.rs diff --git a/crates/parser/test_data/parser/ok/0045_block_attrs.rast b/crates/parser/test_data/parser/ok/0045_block_attrs.rast index bef13807116..fad574a4769 100644 --- a/crates/parser/test_data/parser/ok/0045_block_attrs.rast +++ b/crates/parser/test_data/parser/ok/0045_block_attrs.rast @@ -60,7 +60,7 @@ SOURCE_FILE IDENT "doc" TOKEN_TREE L_PAREN "(" - STRING "\"Being validated is not affected by duplcates\"" + STRING "\"Being validated is not affected by duplicates\"" R_PAREN ")" R_BRACK "]" WHITESPACE "\n " diff --git a/crates/parser/test_data/parser/ok/0045_block_attrs.rs b/crates/parser/test_data/parser/ok/0045_block_attrs.rs index f16c4566e77..0969ea1659d 100644 --- a/crates/parser/test_data/parser/ok/0045_block_attrs.rs +++ b/crates/parser/test_data/parser/ok/0045_block_attrs.rs @@ -3,7 +3,7 @@ fn inner() { //! As are ModuleDoc style comments { #![doc("Inner attributes are allowed in blocks used as statements")] - #![doc("Being validated is not affected by duplcates")] + #![doc("Being validated is not affected by duplicates")] //! As are ModuleDoc style comments }; { diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 3f2cfed806f..e2a815fb7c5 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -48,7 +48,7 @@ tracing-tree = "0.2.1" always-assert = "0.1.2" # These dependencies are unused, but we pin them to a version here to restrict them for our transitive dependencies -# so that we don't pull in duplicates of their depdendenceies like windows-sys and syn 1 vs 2 +# so that we don't pull in duplicates of their dependencies like windows-sys and syn 1 vs 2 # these would pull in serde 2 thiserror = "=1.0.39" serde_repr = "=0.1.11" diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 27445d1f712..a7e949e21f3 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -338,7 +338,7 @@ config_data! { inlayHints_closingBraceHints_minLines: usize = "25", /// Whether to show inlay type hints for return types of closures. inlayHints_closureReturnTypeHints_enable: ClosureReturnTypeHintsDef = "\"never\"", - /// Closure notation in type and chaining inaly hints. + /// Closure notation in type and chaining inlay hints. inlayHints_closureStyle: ClosureStyle = "\"impl_fn\"", /// Whether to show enum variant discriminant hints. inlayHints_discriminantHints_enable: DiscriminantHintsDef = "\"never\"", @@ -488,7 +488,7 @@ config_data! { /// When enabled, rust-analyzer will emit special token types for operator tokens instead /// of the generic `operator` token type. semanticHighlighting_operator_specialization_enable: bool = "false", - /// Use semantic tokens for punctuations. + /// Use semantic tokens for punctuation. /// /// When disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when /// they are tagged with modifiers or have a special role. @@ -496,7 +496,7 @@ config_data! { /// When enabled, rust-analyzer will emit a punctuation semantic token for the `!` of macro /// calls. semanticHighlighting_punctuation_separate_macro_bang: bool = "false", - /// Use specialized semantic tokens for punctuations. + /// Use specialized semantic tokens for punctuation. /// /// When enabled, rust-analyzer will emit special token types for punctuation tokens instead /// of the generic `punctuation` token type. @@ -1967,7 +1967,7 @@ fn get_field( alias: Option<&'static str>, default: &str, ) -> T { - // XXX: check alias first, to work-around the VS Code where it pre-fills the + // XXX: check alias first, to work around the VS Code where it pre-fills the // defaults instead of sending an empty object. alias .into_iter() @@ -2199,8 +2199,8 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json "enumDescriptions": [ "Always show adjustment hints as prefix (`*expr`).", "Always show adjustment hints as postfix (`expr.*`).", - "Show prefix or postfix depending on which uses less parenthesis, prefering prefix.", - "Show prefix or postfix depending on which uses less parenthesis, prefering postfix.", + "Show prefix or postfix depending on which uses less parenthesis, preferring prefix.", + "Show prefix or postfix depending on which uses less parenthesis, preferring postfix.", ] }, "CargoFeaturesDef" => set! { diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 616d8fca5f3..4fe957e854d 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -288,7 +288,7 @@ impl GlobalState { { let raw_database = self.analysis_host.raw_database(); // FIXME: ideally we should only trigger a workspace fetch for non-library changes - // but somethings going wrong with the source root business when we add a new local + // but something's going wrong with the source root business when we add a new local // crate see https://github.com/rust-lang/rust-analyzer/issues/13029 if let Some(path) = workspace_structure_change { self.fetch_workspaces_queue diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index f9930fb2599..ccb04cb0f15 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -36,7 +36,7 @@ pub fn main_loop(config: Config, connection: Connection) -> Result<()> { // temporary bumped. This optimization backfires in our case: each time the // `main_loop` schedules a task to run on a threadpool, the worker threads // gets a higher priority, and (on a machine with fewer cores) displaces the - // main loop! We work-around this by marking the main loop as a + // main loop! We work around this by marking the main loop as a // higher-priority thread. // // https://docs.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs index 701e6232d58..f3d644c680e 100644 --- a/crates/syntax/src/parsing/reparsing.rs +++ b/crates/syntax/src/parsing/reparsing.rs @@ -166,8 +166,8 @@ fn merge_errors( } res.extend(new_errors.into_iter().map(|new_err| { // fighting borrow checker with a variable ;) - let offseted_range = new_err.range() + range_before_reparse.start(); - new_err.with_range(offseted_range) + let offsetted_range = new_err.range() + range_before_reparse.start(); + new_err.with_range(offsetted_range) })); res } @@ -408,7 +408,7 @@ enum Foo { #[test] fn reparse_str_token_with_error_fixed() { - do_check(r#""unterinated$0$0"#, "\"", 12); + do_check(r#""unterminated$0$0"#, "\"", 13); } #[test] diff --git a/crates/syntax/src/validation.rs b/crates/syntax/src/validation.rs index fb2381110bf..5ff01eb44e7 100644 --- a/crates/syntax/src/validation.rs +++ b/crates/syntax/src/validation.rs @@ -175,14 +175,14 @@ pub(crate) fn validate_block_structure(root: &SyntaxNode) { assert_eq!( node.parent(), pair.parent(), - "\nunpaired curlys:\n{}\n{:#?}\n", + "\nunpaired curlies:\n{}\n{:#?}\n", root.text(), root, ); assert!( node.next_sibling_or_token().is_none() && pair.prev_sibling_or_token().is_none(), - "\nfloating curlys at {:?}\nfile:\n{}\nerror:\n{}\n", + "\nfloating curlies at {:?}\nfile:\n{}\nerror:\n{}\n", node, root.text(), node, diff --git a/crates/syntax/test_data/parser/fuzz-failures/0000.rs b/crates/syntax/test_data/parser/fuzz-failures/0000.rs index f977d23c480..13852aa78b8 100644 --- a/crates/syntax/test_data/parser/fuzz-failures/0000.rs +++ b/crates/syntax/test_data/parser/fuzz-failures/0000.rs @@ -39,13 +39,13 @@ ast::Root::cast(self.syntax()).unwrap() } pub fn syntax(&self) -> SyntaxNodeRef { - self.root.brroowed() + self.root.borrowed() } mp_tree(root), ); assert!( node.next_sibling().is_none() && pair.prev_sibling().is_none(), - "\nfloating curlys at {:?}\nfile:\n{}\nerror:\n{}\n", + "\nfloating curlies at {:?}\nfile:\n{}\nerror:\n{}\n", node, root.text(), node.text(), diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 9df6b0ff28f..d748400b695 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -333,7 +333,7 @@ Moreover, it would be cool if editors didn't need to implement even basic langua ### Unresolved Question -* Should we return a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair? +* Should we return a nested brace structure, to allow [paredit](https://paredit.org/)-like actions of jump *out* of the current brace pair? This is how `SelectionRange` request works. * Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs? diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index e92e6ae92cc..0c3432e9036 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -477,7 +477,7 @@ Whether to show inlay type hints for return types of closures. [[rust-analyzer.inlayHints.closureStyle]]rust-analyzer.inlayHints.closureStyle (default: `"impl_fn"`):: + -- -Closure notation in type and chaining inaly hints. +Closure notation in type and chaining inlay hints. -- [[rust-analyzer.inlayHints.discriminantHints.enable]]rust-analyzer.inlayHints.discriminantHints.enable (default: `"never"`):: + @@ -758,7 +758,7 @@ of the generic `operator` token type. [[rust-analyzer.semanticHighlighting.punctuation.enable]]rust-analyzer.semanticHighlighting.punctuation.enable (default: `false`):: + -- -Use semantic tokens for punctuations. +Use semantic tokens for punctuation. When disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when they are tagged with modifiers or have a special role. @@ -772,7 +772,7 @@ calls. [[rust-analyzer.semanticHighlighting.punctuation.specialization.enable]]rust-analyzer.semanticHighlighting.punctuation.specialization.enable (default: `false`):: + -- -Use specialized semantic tokens for punctuations. +Use specialized semantic tokens for punctuation. When enabled, rust-analyzer will emit special token types for punctuation tokens instead of the generic `punctuation` token type. diff --git a/editors/code/package.json b/editors/code/package.json index 3c0486ad680..f6ad2f7908f 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -1030,7 +1030,7 @@ ] }, "rust-analyzer.inlayHints.closureStyle": { - "markdownDescription": "Closure notation in type and chaining inaly hints.", + "markdownDescription": "Closure notation in type and chaining inlay hints.", "default": "impl_fn", "type": "string", "enum": [ @@ -1094,8 +1094,8 @@ "enumDescriptions": [ "Always show adjustment hints as prefix (`*expr`).", "Always show adjustment hints as postfix (`expr.*`).", - "Show prefix or postfix depending on which uses less parenthesis, prefering prefix.", - "Show prefix or postfix depending on which uses less parenthesis, prefering postfix." + "Show prefix or postfix depending on which uses less parenthesis, preferring prefix.", + "Show prefix or postfix depending on which uses less parenthesis, preferring postfix." ] }, "rust-analyzer.inlayHints.lifetimeElisionHints.enable": { @@ -1381,7 +1381,7 @@ "type": "boolean" }, "rust-analyzer.semanticHighlighting.punctuation.enable": { - "markdownDescription": "Use semantic tokens for punctuations.\n\nWhen disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when\nthey are tagged with modifiers or have a special role.", + "markdownDescription": "Use semantic tokens for punctuation.\n\nWhen disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when\nthey are tagged with modifiers or have a special role.", "default": false, "type": "boolean" }, @@ -1391,7 +1391,7 @@ "type": "boolean" }, "rust-analyzer.semanticHighlighting.punctuation.specialization.enable": { - "markdownDescription": "Use specialized semantic tokens for punctuations.\n\nWhen enabled, rust-analyzer will emit special token types for punctuation tokens instead\nof the generic `punctuation` token type.", + "markdownDescription": "Use specialized semantic tokens for punctuation.\n\nWhen enabled, rust-analyzer will emit special token types for punctuation tokens instead\nof the generic `punctuation` token type.", "default": false, "type": "boolean" }, diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 35627e2fc6b..623fb102953 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts @@ -157,7 +157,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise cargoTask.presentationOptions.clear = true; // Sadly, this doesn't prevent focus stealing if the terminal is currently - // hidden, and will become revealed due to task exucution. + // hidden, and will become revealed due to task execution. cargoTask.presentationOptions.focus = false; return cargoTask;