mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Avoid cloning Name
when looking up function and class types (#14092)
This commit is contained in:
parent
a7a78f939c
commit
bc0586d922
5 changed files with 27 additions and 4 deletions
|
@ -205,6 +205,21 @@ impl schemars::JsonSchema for Name {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "salsa")]
|
||||
impl salsa::plumbing::interned::Lookup<Name> for &str {
|
||||
fn hash<H: Hasher>(&self, h: &mut H) {
|
||||
std::hash::Hash::hash(self, h);
|
||||
}
|
||||
|
||||
fn eq(&self, data: &Name) -> bool {
|
||||
self == data
|
||||
}
|
||||
|
||||
fn into_owned(self) -> Name {
|
||||
Name::new(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// A representation of a qualified name, like `typing.List`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct QualifiedName<'a>(SegmentsVec<'a>);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue