Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/hir-def/src/attrs/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ pub struct Docs {
docs: String,
/// A sorted map from an offset in `docs` to an offset in the source code.
docs_source_map: Vec<DocsSourceMapLine>,
/// If the item is an outlined module (`mod foo;`), `docs_source_map` store the concatenated
/// If the item is an outlined module (`mod foo;`), `docs_source_map` stores the concatenated
/// list of the outline and inline docs (outline first). Then, this field contains the [`HirFileId`]
/// of the outline declaration, and the index in `docs` from which the inline docs
/// begin.
outline_mod: Option<(HirFileId, usize)>,
inline_file: HirFileId,
/// The size the prepended prefix, which does not map to real doc comments.
/// The size of the prepended prefix, which does not map to real doc comments.
prefix_len: TextSize,
/// The offset in `docs` from which the docs are inner attributes/comments.
inline_inner_docs_start: Option<TextSize>,
Expand Down
8 changes: 4 additions & 4 deletions crates/hir-def/src/nameres/path_resolution.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! This modules implements a function to resolve a path `foo::bar::baz` to a
//! def, which is used within the name resolution.
//! This module implements a function to resolve a path `foo::bar::baz` to a
//! def, which is used within name resolution.
//!
//! When name resolution is finished, the result of resolving a path is either
//! `Some(def)` or `None`. However, when we are in process of resolving imports
//! `Some(def)` or `None`. However, when we are in the process of resolving imports
//! or macros, there's a third possibility:
//!
//! I can't resolve this path right now, but I might be resolve this path
//! I can't resolve this path right now, but I might be able to resolve this path
//! later, when more macros are expanded.
//!
//! `ReachedFixedPoint` signals about this.
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/infer/place_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<'db> InferenceContext<'db> {

// We have to replace the operator with the mutable variant for the
// program to compile, so we don't really have a choice here and want
// to just try using `DerefMut` even if its not in the item bounds
// to just try using `DerefMut` even if it's not in the item bounds
// of the opaque.
let treat_opaques = TreatNotYetDefinedOpaques::AsInfer;
table.lookup_method_for_operator(
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl<'db> MemoryMap<'db> {
}
}

/// Return an index of a parameter in the generic type parameter list by it's id.
/// Returns the index of a parameter in the generic type parameter list by its id.
pub fn type_or_const_param_idx(db: &dyn HirDatabase, id: TypeOrConstParamId) -> u32 {
generics::generics(db, id.parent).type_or_const_param_idx(id)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/next_solver/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl<'a, 'db> InspectCandidate<'a, 'db> {
/// Certainty passed into `evaluate_added_goals_and_make_canonical_response`.
///
/// If this certainty is `Yes`, then we must be confident that the candidate
/// must hold iff it's nested goals hold. This is not true if the certainty is
/// must hold iff its nested goals hold. This is not true if the certainty is
/// `Maybe(..)`, which suggests we forced ambiguity instead.
///
/// This is *not* the certainty of the candidate's full nested evaluation, which
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl<'db> HirDisplay<'db> for Adt {
impl<'db> HirDisplay<'db> for Struct {
fn hir_fmt(&self, f: &mut HirFormatter<'_, 'db>) -> Result {
let module_id = self.module(f.db).id;
// FIXME: Render repr if its set explicitly?
// FIXME: Render repr if it's set explicitly?
write_visibility(module_id, self.visibility(f.db), f)?;
f.write_str("struct ")?;
write!(f, "{}", self.name(f.db).display(f.db, f.edition()))?;
Expand Down
4 changes: 2 additions & 2 deletions crates/hir/src/semantics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ impl<'db> SemanticsImpl<'db> {
}

/// Attempts to map the node out of macro expanded files.
/// This only work for attribute expansions, as other ones do not have nodes as input.
/// This only works for attribute expansions, as other ones do not have nodes as input.
pub fn original_ast_node<N: AstNode>(&self, node: N) -> Option<N> {
self.wrap_node_infile(node).original_ast_node_rooted(self.db).map(
|InRealFile { file_id, value }| {
Expand All @@ -1574,7 +1574,7 @@ impl<'db> SemanticsImpl<'db> {
}

/// Attempts to map the node out of macro expanded files.
/// This only work for attribute expansions, as other ones do not have nodes as input.
/// This only works for attribute expansions, as other ones do not have nodes as input.
pub fn original_syntax_node_rooted(&self, node: &SyntaxNode) -> Option<SyntaxNode> {
let InFile { file_id, .. } = self.find_file(node);
InFile::new(file_id, node).original_syntax_node_rooted(self.db).map(
Expand Down
6 changes: 3 additions & 3 deletions crates/hir/src/semantics/source_to_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! This problem is a part of more-or-less every IDE feature implemented. Every
//! IDE functionality (like goto to definition), conceptually starts with a
//! specific cursor position in a file. Starting with this text offset, we first
//! figure out what syntactic construct are we at: is this a pattern, an
//! figure out what syntactic construct we are at: is this a pattern, an
//! expression, an item definition.
//!
//! Knowing only the syntax gives us relatively little info. For example,
Expand All @@ -32,11 +32,11 @@
//! Specifically, the algorithm goes like this:
//!
//! 1. Find the syntactic container for the syntax. For example, field's
//! container is the struct, and structs container is a module.
//! container is the struct, and the struct's container is a module.
//! 2. Recursively get the def corresponding to container.
//! 3. Ask the container def for all child defs. These child defs contain
//! the answer and answer's siblings.
//! 4. For each child def, ask for it's source.
//! 4. For each child def, ask for its source.
//! 5. The child def whose source is the syntax node we've started with
//! is the answer.
//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub(crate) fn replace_if_let_with_match(

if !pat_seen && cond_bodies.len() != 1 {
// Don't offer turning an if (chain) without patterns into a match,
// unless its a simple `if cond { .. } (else { .. })`
// unless it's a simple `if cond { .. } (else { .. })`
return None;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/ide-completion/src/completions/attribute/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct DeriveDependencies {
}

/// Standard Rust derives that have dependencies
/// (the dependencies are needed so that the main derive don't break the compilation when added)
/// (the dependencies are needed so that the main derive doesn't break the compilation when added)
const DEFAULT_DERIVE_DEPENDENCIES: &[DeriveDependencies] = &[
DeriveDependencies { label: "Copy", dependencies: &["Clone"] },
DeriveDependencies { label: "Eq", dependencies: &["PartialEq"] },
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-completion/src/completions/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) fn complete_type_path<'db>(
ScopeDef::ModuleDef(Function(_) | EnumVariant(_) | Static(_)) | ScopeDef::Local(_) => {
false
}
// unless its a constant in a generic arg list position
// unless it's a constant in a generic arg list position
ScopeDef::ModuleDef(Const(_)) | ScopeDef::GenericParam(ConstParam(_)) => {
location.complete_consts()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-completion/src/context/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ fn classify_name_ref<'db>(
let res = sema.resolve_path(&qualifier);

// For understanding how and why super_chain_len is calculated the way it
// is check the documentation at it's definition
// is check the documentation at its definition
let mut segment_count = 0;
let super_count = iter::successors(Some(qualifier.clone()), |p| p.qualifier())
.take_while(|p| {
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-completion/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl CompletionRelevance {
}

if let Some(trait_) = trait_ {
// lower rank trait methods unless its notable
// lower rank trait methods unless it's notable
if !trait_.notable_trait {
score -= 5;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/ide-db/src/source_change.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This modules defines type to represent changes to the source code, that flow
//! from the server to the client.
//! This module defines types that represent changes to source code flowing from
//! the server to the client.
//!
//! It can be viewed as a dual for [`Change`][vfs::Change].

Expand Down
2 changes: 1 addition & 1 deletion crates/ide-db/src/syntax_helpers/tree_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff {
}
(Some(ref lhs_ele), Some(ref rhs_ele)) if syntax_element_eq(lhs_ele, rhs_ele) => {}
(Some(lhs_ele), Some(rhs_ele)) => {
// nodes differ, look for lhs_ele in rhs, if its found we can mark everything up
// nodes differ, look for lhs_ele in rhs, if it's found we can mark everything up
// until that element as insertions. This is important to keep the diff minimal
// in regards to insertions that have been actually done, this is important for
// use insertions as we do not want to replace the entire module node.
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-ssr/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<'db> MatchFinder<'db> {
usage_cache.find(&definition).unwrap()
}

/// Returns the scope within which we want to search. We don't want un unrestricted search
/// Returns the scope within which we want to search. We don't want an unrestricted search
/// scope, since we don't want to find references in external dependencies.
fn search_scope(&self) -> SearchScope {
// FIXME: We should ideally have a test that checks that we edit local roots and not library
Expand Down
2 changes: 1 addition & 1 deletion crates/ide-ssr/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ fn match_failure_reasons() {
#[test]
fn overlapping_possible_matches() {
// There are three possible matches here, however the middle one, `foo(foo(foo(42)))` shouldn't
// match because it overlaps with the outer match. The inner match is permitted since it's is
// match because it overlaps with the outer match. The inner match is permitted since it is
// contained entirely within the placeholder of the outer match.
assert_matches(
"foo(foo($a))",
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/typing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ fn on_left_angle_typed(
) -> Option<TextEdit> {
let file_text = reparsed.syntax().text();

// Find the next non-whitespace char in the line, check if its a `>`
// Find the next non-whitespace char in the line, check if it's a `>`
let mut next_offset = offset;
while file_text.char_at(next_offset) == Some(' ') {
next_offset += TextSize::of(' ')
Expand Down
2 changes: 1 addition & 1 deletion crates/mbe/src/expander/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ struct MatchState<'t> {
/// Process the matcher positions of `cur_items` until it is empty. In the process, this will
/// produce more items in `next_items`, `eof_items`, and `bb_items`.
///
/// For more info about the how this happens, see the module-level doc comments and the inline
/// For more info about how this happens, see the module-level doc comments and the inline
/// comments of this function.
///
/// # Parameters
Expand Down
2 changes: 1 addition & 1 deletion crates/parser/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::SyntaxKind;
#[derive(Default)]
pub struct Output {
/// 32-bit encoding of events. If LSB is zero, then that's an index into the
/// error vector. Otherwise, it's one of the thee other variants, with data encoded as
/// error vector. Otherwise, it's one of the three other variants, with data encoded as
///
/// ```text
/// |16 bit kind|8 bit n_input_tokens|4 bit tag|4 bit leftover|
Expand Down
2 changes: 1 addition & 1 deletion crates/proc-macro-api/src/legacy_protocol/msg/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//! ```
//!
//! We probably should replace most of the code here with bincode someday, but,
//! as we don't have bincode in Cargo.toml yet, lets stick with serde_json for
//! as we don't have bincode in Cargo.toml yet, let's stick with serde_json for
//! the time being.

#[cfg(feature = "in-rust-tree")]
Expand Down
4 changes: 2 additions & 2 deletions crates/rust-analyzer/src/cli/ssr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl flags::Ssr {

impl flags::Search {
/// Searches for `patterns`, printing debug information for any nodes whose text exactly matches
/// `debug_snippet`. This is intended for debugging and probably isn't in it's current form useful
/// for much else.
/// `debug_snippet`. This is intended for debugging and probably isn't useful in its current
/// form for much else.
pub fn run(self) -> anyhow::Result<()> {
use ide_db::base_db::SourceDatabase;
let cargo_config =
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ impl GlobalState {

let path = VfsPath::from(path);
// If the file is in mem docs, it's managed by the client via
// notifications so only set it if its not in there. Library files are
// notifications so only set it if it's not in there. Library files are
// exempt from that authority as they are considered immutable, for
// them disk is always the source of truth.
let is_library = self.source_root_config.path_is_library(&path);
Expand Down
4 changes: 2 additions & 2 deletions crates/span/src/ast_id.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! `AstIdMap` allows to create stable IDs for "large" syntax nodes like items
//! and macro calls.
//!
//! Specifically, it enumerates all items in a file and uses position of a an
//! item as an ID. That way, id's don't change unless the set of items itself
//! Specifically, it enumerates all items in a file and uses the position of an
//! item as an ID. That way, IDs don't change unless the set of items itself
//! changes.
//!
//! These IDs are tricky. If one of them invalidates, its interned ID invalidates,
Expand Down
6 changes: 3 additions & 3 deletions crates/vfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl Vfs {
///
/// Returns `true` if the file was modified, and saves the [change](ChangedFile).
///
/// If the path does not currently exists in the `Vfs`, allocates a new
/// If the path does not currently exist in the `Vfs`, allocates a new
/// [`FileId`] for it.
pub fn set_file_contents(&mut self, path: VfsPath, contents: Option<Vec<u8>>) -> bool {
let _p = span!(Level::INFO, "Vfs::set_file_contents").entered();
Expand Down Expand Up @@ -280,7 +280,7 @@ impl Vfs {
true
}

/// Drain and returns all the changes in the `Vfs`.
/// Drains and returns all the changes in the `Vfs`.
pub fn take_changes(&mut self) -> IndexMap<FileId, ChangedFile, BuildHasherDefault<FxHasher>> {
mem::take(&mut self.changes)
}
Expand All @@ -292,7 +292,7 @@ impl Vfs {

/// Returns the id associated with `path`
///
/// - If `path` does not exists in the `Vfs`, allocate a new id for it, associated with a
/// - If `path` does not exist in the `Vfs`, allocates a new id for it, associated with a
/// deleted file;
/// - Else, returns `path`'s id.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/vfs/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum Message {
n_total: usize,
/// The files that have been loaded successfully.
n_done: LoadingProgress,
/// The dir being loaded, `None` if its for a file.
/// The dir being loaded, `None` if it's for a file.
dir: Option<AbsPathBuf>,
/// The [`Config`] version.
config_version: u32,
Expand Down
4 changes: 2 additions & 2 deletions crates/vfs/src/path_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(crate) struct PathInterner {
impl PathInterner {
/// Get the id corresponding to `path`.
///
/// If `path` does not exists in `self`, returns [`None`].
/// If `path` does not exist in `self`, returns [`None`].
pub(crate) fn get(&self, path: &VfsPath) -> Option<FileId> {
self.map.get_index_of(path).map(|i| FileId(i as u32))
}
Expand All @@ -36,7 +36,7 @@ impl PathInterner {
///
/// # Panics
///
/// Panics if `id` does not exists in `self`.
/// Panics if `id` does not exist in `self`.
pub(crate) fn lookup(&self, id: FileId) -> &VfsPath {
self.map.get_index(id.0 as usize).unwrap()
}
Expand Down