minor: Make use of some new SmolStr improvements

This commit is contained in:
Lukas Wirth 2024-01-17 13:43:18 +01:00
parent 0bdbf497b6
commit 83591268ab
18 changed files with 80 additions and 61 deletions

View file

@ -74,7 +74,7 @@ fn variant_hints(
},
Some(InlayTooltip::String(match &d {
Ok(_) => "enum variant discriminant".into(),
Err(e) => format!("{e:?}").into(),
Err(e) => format!("{e:?}"),
})),
None,
);

View file

@ -4,11 +4,11 @@
//! ```
use ide_db::{syntax_helpers::node_ext::walk_ty, FxHashMap};
use itertools::Itertools;
use syntax::SmolStr;
use syntax::{
ast::{self, AstNode, HasGenericParams, HasName},
SyntaxToken,
};
use syntax::{format_smolstr, SmolStr};
use crate::{InlayHint, InlayHintPosition, InlayHintsConfig, InlayKind, LifetimeElisionHints};
@ -80,7 +80,7 @@ pub(super) fn hints(
let mut gen_idx_name = {
let mut gen = (0u8..).map(|idx| match idx {
idx if idx < 10 => SmolStr::from_iter(['\'', (idx + 48) as char]),
idx => format!("'{idx}").into(),
idx => format_smolstr!("'{idx}"),
});
move || gen.next().unwrap_or_default()
};