Skip to content

Commit 875ad9b

Browse files
committed
Bump smol_str from 0.1.16 to 0.1.17
1 parent 5d137f2 commit 875ad9b

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir_expand/src/name.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ impl Name {
4343
}
4444

4545
/// Shortcut to create inline plain text name
46-
const fn new_inline_ascii(text: &[u8]) -> Name {
47-
Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text))
46+
const fn new_inline(text: &str) -> Name {
47+
Name::new_text(SmolStr::new_inline(text))
4848
}
4949

5050
/// Resolve a name from the text of token.
@@ -127,7 +127,7 @@ pub mod known {
127127
$(
128128
#[allow(bad_style)]
129129
pub const $ident: super::Name =
130-
super::Name::new_inline_ascii(stringify!($ident).as_bytes());
130+
super::Name::new_inline(stringify!($ident));
131131
)*
132132
};
133133
}
@@ -210,8 +210,8 @@ pub mod known {
210210
);
211211

212212
// self/Self cannot be used as an identifier
213-
pub const SELF_PARAM: super::Name = super::Name::new_inline_ascii(b"self");
214-
pub const SELF_TYPE: super::Name = super::Name::new_inline_ascii(b"Self");
213+
pub const SELF_PARAM: super::Name = super::Name::new_inline("self");
214+
pub const SELF_TYPE: super::Name = super::Name::new_inline("Self");
215215

216216
#[macro_export]
217217
macro_rules! name {

crates/hir_ty/src/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ impl<'a> InferenceContext<'a> {
555555

556556
fn resolve_lang_item(&self, name: &str) -> Option<LangItemTarget> {
557557
let krate = self.resolver.krate()?;
558-
let name = SmolStr::new_inline_from_ascii(name.len(), name.as_bytes());
558+
let name = SmolStr::new_inline(name);
559559
self.db.lang_item(krate, name)
560560
}
561561

crates/mbe/src/syntax_bridge.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,10 @@ impl<'a> TreeSink for TtTreeSink<'a> {
636636
let (text, id) = match leaf {
637637
tt::Leaf::Ident(ident) => (ident.text.clone(), ident.id),
638638
tt::Leaf::Punct(punct) => {
639-
(SmolStr::new_inline_from_ascii(1, &[punct.char as u8]), punct.id)
639+
assert!(punct.char.is_ascii());
640+
let char = &(punct.char as u8);
641+
let text = std::str::from_utf8(std::slice::from_ref(char)).unwrap();
642+
(SmolStr::new_inline(text), punct.id)
640643
}
641644
tt::Leaf::Literal(lit) => (lit.text.clone(), lit.id),
642645
};

0 commit comments

Comments
 (0)