mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-10 05:38:15 +00:00
Fix typos (#16908)
## Summary The noun is spelled "descend<strong><em>a</em></strong>nt" and the adjective "descend<strong><em>e</em></strong>nt". ## Test Plan [From the English Wiktionary](https://en.wiktionary.org/wiki/descendent#Usage_notes): > The adjective, "descending from a biological ancestor", may be spelt either with an <i>[a](https://en.wiktionary.org/wiki/-ant)</i> or with an <i>[e](https://en.wiktionary.org/wiki/-ent)</i> in the final syllable (see [descendant](https://en.wiktionary.org/wiki/descendant)). However, the noun <i>descendant</i>, "one who is the progeny of someone", may be spelt only with an <i>[a](https://en.wiktionary.org/wiki/-ant)</i>. Compare also <i>[dependent](https://en.wiktionary.org/wiki/dependent#English)</i> and <i>[dependant](https://en.wiktionary.org/wiki/dependant#English)</i>.
This commit is contained in:
parent
ee51c2a389
commit
2d892bc9f7
3 changed files with 27 additions and 27 deletions
|
@ -235,8 +235,8 @@ impl<'db> SemanticIndex<'db> {
|
||||||
|
|
||||||
/// Returns an iterator over the descendent scopes of `scope`.
|
/// Returns an iterator over the descendent scopes of `scope`.
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub(crate) fn descendent_scopes(&self, scope: FileScopeId) -> DescendentsIter {
|
pub(crate) fn descendent_scopes(&self, scope: FileScopeId) -> DescendantsIter {
|
||||||
DescendentsIter::new(self, scope)
|
DescendantsIter::new(self, scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an iterator over the direct child scopes of `scope`.
|
/// Returns an iterator over the direct child scopes of `scope`.
|
||||||
|
@ -339,55 +339,55 @@ impl<'a> Iterator for AncestorsIter<'a> {
|
||||||
|
|
||||||
impl FusedIterator for AncestorsIter<'_> {}
|
impl FusedIterator for AncestorsIter<'_> {}
|
||||||
|
|
||||||
pub struct DescendentsIter<'a> {
|
pub struct DescendantsIter<'a> {
|
||||||
next_id: FileScopeId,
|
next_id: FileScopeId,
|
||||||
descendents: std::slice::Iter<'a, Scope>,
|
descendants: std::slice::Iter<'a, Scope>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DescendentsIter<'a> {
|
impl<'a> DescendantsIter<'a> {
|
||||||
fn new(symbol_table: &'a SemanticIndex, scope_id: FileScopeId) -> Self {
|
fn new(symbol_table: &'a SemanticIndex, scope_id: FileScopeId) -> Self {
|
||||||
let scope = &symbol_table.scopes[scope_id];
|
let scope = &symbol_table.scopes[scope_id];
|
||||||
let scopes = &symbol_table.scopes[scope.descendents()];
|
let scopes = &symbol_table.scopes[scope.descendants()];
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
next_id: scope_id + 1,
|
next_id: scope_id + 1,
|
||||||
descendents: scopes.iter(),
|
descendants: scopes.iter(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for DescendentsIter<'a> {
|
impl<'a> Iterator for DescendantsIter<'a> {
|
||||||
type Item = (FileScopeId, &'a Scope);
|
type Item = (FileScopeId, &'a Scope);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
let descendent = self.descendents.next()?;
|
let descendant = self.descendants.next()?;
|
||||||
let id = self.next_id;
|
let id = self.next_id;
|
||||||
self.next_id = self.next_id + 1;
|
self.next_id = self.next_id + 1;
|
||||||
|
|
||||||
Some((id, descendent))
|
Some((id, descendant))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
self.descendents.size_hint()
|
self.descendants.size_hint()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FusedIterator for DescendentsIter<'_> {}
|
impl FusedIterator for DescendantsIter<'_> {}
|
||||||
|
|
||||||
impl ExactSizeIterator for DescendentsIter<'_> {}
|
impl ExactSizeIterator for DescendantsIter<'_> {}
|
||||||
|
|
||||||
pub struct ChildrenIter<'a> {
|
pub struct ChildrenIter<'a> {
|
||||||
parent: FileScopeId,
|
parent: FileScopeId,
|
||||||
descendents: DescendentsIter<'a>,
|
descendants: DescendantsIter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ChildrenIter<'a> {
|
impl<'a> ChildrenIter<'a> {
|
||||||
fn new(module_symbol_table: &'a SemanticIndex, parent: FileScopeId) -> Self {
|
fn new(module_symbol_table: &'a SemanticIndex, parent: FileScopeId) -> Self {
|
||||||
let descendents = DescendentsIter::new(module_symbol_table, parent);
|
let descendants = DescendantsIter::new(module_symbol_table, parent);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
parent,
|
parent,
|
||||||
descendents,
|
descendants,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ impl<'a> Iterator for ChildrenIter<'a> {
|
||||||
type Item = (FileScopeId, &'a Scope);
|
type Item = (FileScopeId, &'a Scope);
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.descendents
|
self.descendants
|
||||||
.find(|(_, scope)| scope.parent() == Some(self.parent))
|
.find(|(_, scope)| scope.parent() == Some(self.parent))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1155,9 +1155,9 @@ def x():
|
||||||
|
|
||||||
let index = semantic_index(&db, file);
|
let index = semantic_index(&db, file);
|
||||||
|
|
||||||
let descendents = index.descendent_scopes(FileScopeId::global());
|
let descendants = index.descendent_scopes(FileScopeId::global());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
scope_names(descendents, &db, file),
|
scope_names(descendants, &db, file),
|
||||||
vec!["Test", "foo", "bar", "baz", "x"]
|
vec!["Test", "foo", "bar", "baz", "x"]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ impl<'db> SemanticIndexBuilder<'db> {
|
||||||
|
|
||||||
let children_end = self.scopes.next_index();
|
let children_end = self.scopes.next_index();
|
||||||
let popped_scope = &mut self.scopes[popped_scope_id];
|
let popped_scope = &mut self.scopes[popped_scope_id];
|
||||||
popped_scope.extend_descendents(children_end);
|
popped_scope.extend_descendants(children_end);
|
||||||
|
|
||||||
if !popped_scope.is_eager() {
|
if !popped_scope.is_eager() {
|
||||||
return popped_scope_id;
|
return popped_scope_id;
|
||||||
|
|
|
@ -171,19 +171,19 @@ impl FileScopeId {
|
||||||
pub struct Scope {
|
pub struct Scope {
|
||||||
parent: Option<FileScopeId>,
|
parent: Option<FileScopeId>,
|
||||||
node: NodeWithScopeKind,
|
node: NodeWithScopeKind,
|
||||||
descendents: Range<FileScopeId>,
|
descendants: Range<FileScopeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scope {
|
impl Scope {
|
||||||
pub(super) fn new(
|
pub(super) fn new(
|
||||||
parent: Option<FileScopeId>,
|
parent: Option<FileScopeId>,
|
||||||
node: NodeWithScopeKind,
|
node: NodeWithScopeKind,
|
||||||
descendents: Range<FileScopeId>,
|
descendants: Range<FileScopeId>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Scope {
|
Scope {
|
||||||
parent,
|
parent,
|
||||||
node,
|
node,
|
||||||
descendents,
|
descendants,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,12 +199,12 @@ impl Scope {
|
||||||
self.node().scope_kind()
|
self.node().scope_kind()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn descendents(&self) -> Range<FileScopeId> {
|
pub fn descendants(&self) -> Range<FileScopeId> {
|
||||||
self.descendents.clone()
|
self.descendants.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn extend_descendents(&mut self, children_end: FileScopeId) {
|
pub(super) fn extend_descendants(&mut self, children_end: FileScopeId) {
|
||||||
self.descendents = self.descendents.start..children_end;
|
self.descendants = self.descendants.start..children_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_eager(&self) -> bool {
|
pub(crate) fn is_eager(&self) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue