[red-knot] Minor improvements to KnownFunction API (#15441)

A small PR to reduce some of the code duplication between the various
branches, make it a little more readable and move the API closer to what
we already have for `KnownClass`
This commit is contained in:
Alex Waygood 2025-01-12 16:06:31 +00:00 committed by GitHub
parent c8795fcb37
commit 06b7f4495e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 60 deletions

View file

@ -154,6 +154,10 @@ impl KnownModule {
}
}
pub const fn is_builtins(self) -> bool {
matches!(self, Self::Builtins)
}
pub const fn is_typing(self) -> bool {
matches!(self, Self::Typing)
}