mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 02:12:22 +00:00
[red-knot] cleanup doc comments and attributes (#12792)
Make `cargo doc -p red_knot_python_semantic --document-private-items` run warning-free. I'd still like to do this for all of ruff and start enforcing it in CI (https://github.com/astral-sh/ruff/issues/12372) but haven't gotten to it yet. But in the meantime I'm trying to maintain it for at least `red_knot_python_semantic`, as it helps to ensure our doc comments stay up to date. A few of the comments I just removed or shortened, as their continued relevance wasn't clear to me; please object in review if you think some of them are important to keep! Also remove a no-longer-needed `allow` attribute.
This commit is contained in:
parent
75131c6f4a
commit
fb9f0c448f
4 changed files with 12 additions and 8 deletions
|
@ -89,8 +89,6 @@ pub(crate) struct SemanticIndex<'db> {
|
|||
scopes: IndexVec<FileScopeId, Scope>,
|
||||
|
||||
/// Map expressions to their corresponding scope.
|
||||
/// We can't use [`ExpressionId`] here, because the challenge is how to get from
|
||||
/// an [`ast::Expr`] to an [`ExpressionId`] (which requires knowing the scope).
|
||||
scopes_by_expression: FxHashMap<ExpressionNodeKey, FileScopeId>,
|
||||
|
||||
/// Map from a node creating a definition to its definition.
|
||||
|
@ -118,7 +116,7 @@ pub(crate) struct SemanticIndex<'db> {
|
|||
impl<'db> SemanticIndex<'db> {
|
||||
/// Returns the symbol table for a specific scope.
|
||||
///
|
||||
/// Use the Salsa cached [`symbol_table`] query if you only need the
|
||||
/// Use the Salsa cached [`symbol_table()`] query if you only need the
|
||||
/// symbol table for a single scope.
|
||||
pub(super) fn symbol_table(&self, scope_id: FileScopeId) -> Arc<SymbolTable> {
|
||||
self.symbol_tables[scope_id].clone()
|
||||
|
@ -126,7 +124,7 @@ impl<'db> SemanticIndex<'db> {
|
|||
|
||||
/// Returns the use-def map for a specific scope.
|
||||
///
|
||||
/// Use the Salsa cached [`use_def_map`] query if you only need the
|
||||
/// Use the Salsa cached [`use_def_map()`] query if you only need the
|
||||
/// use-def map for a single scope.
|
||||
pub(super) fn use_def_map(&self, scope_id: FileScopeId) -> Arc<UseDefMap> {
|
||||
self.use_def_maps[scope_id].clone()
|
||||
|
|
|
@ -26,9 +26,9 @@ use crate::Db;
|
|||
/// ```
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct AstIds {
|
||||
/// Maps expressions to their expression id. Uses `NodeKey` because it avoids cloning [`Parsed`].
|
||||
/// Maps expressions to their expression id.
|
||||
expressions_map: FxHashMap<ExpressionNodeKey, ScopedExpressionId>,
|
||||
/// Maps expressions which "use" a symbol (that is, [`ExprName`]) to a use id.
|
||||
/// Maps expressions which "use" a symbol (that is, [`ast::ExprName`]) to a use id.
|
||||
uses_map: FxHashMap<ExpressionNodeKey, ScopedUseId>,
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ pub(crate) fn infer_scope_types<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Ty
|
|||
TypeInferenceBuilder::new(db, InferenceRegion::Scope(scope), index).finish()
|
||||
}
|
||||
|
||||
/// Cycle recovery for [`infer_definition_types`]: for now, just [`Type::Unknown`]
|
||||
/// Cycle recovery for [`infer_definition_types()`]: for now, just [`Type::Unknown`]
|
||||
/// TODO fixpoint iteration
|
||||
fn infer_definition_types_cycle_recovery<'db>(
|
||||
_db: &'db dyn Db,
|
||||
|
@ -923,7 +923,6 @@ impl<'db> TypeInferenceBuilder<'db> {
|
|||
ty
|
||||
}
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
fn infer_number_literal_expression(&mut self, literal: &ast::ExprNumberLiteral) -> Type<'db> {
|
||||
let ast::ExprNumberLiteral { range: _, value } = literal;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue