mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
internal: intern TypeBound
s
Doesn't save much memory (~2 mb), but interning things is generally a good pattern to follow
This commit is contained in:
parent
05fc97e31b
commit
8ebb8d29e1
12 changed files with 49 additions and 27 deletions
|
@ -13,6 +13,7 @@ use hir_def::{
|
|||
db::DefDatabase,
|
||||
find_path,
|
||||
generics::TypeParamProvenance,
|
||||
intern::{Internable, Interned},
|
||||
item_scope::ItemInNs,
|
||||
path::{Path, PathKind},
|
||||
type_ref::{TypeBound, TypeRef},
|
||||
|
@ -256,6 +257,12 @@ impl<T: HirDisplay> HirDisplay for &'_ T {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: HirDisplay + Internable> HirDisplay for Interned<T> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
HirDisplay::hir_fmt(self.as_ref(), f)
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for ProjectionTy {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue