diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-09-24 16:07:35 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-09-24 16:07:35 +0100 |
commit | 277488b51e22c790b51d5f739ecb33cdd20e903f (patch) | |
tree | c0bc04398f8bd4a008de967af6d70d10817e324d /crates | |
parent | 65592b41be280e0e2ca81c1e127f8cb13fb47ce9 (diff) | |
parent | 875ad9b5c410200f5072515ae91b4ff51cff0448 (diff) |
Merge #6062
6062: Bump smol_str from 0.1.16 to 0.1.17 r=matklad a=woshilapin
When I built `rust-analyzer` today, I noticed the following warnings.
```
warning: use of deprecated item 'syntax::SmolStr::new_inline_from_ascii': Use `new_inline` instead
--> crates/mbe/src/syntax_bridge.rs:639:30
|
639 | ... (SmolStr::new_inline_from_ascii(1, &[punct.char as u8]), punct.id)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: 1 warning emitted
```
So I thought it would be a nice small PR.
Co-authored-by: Jean SIMARD <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_expand/src/name.rs | 10 | ||||
-rw-r--r-- | crates/hir_ty/src/infer.rs | 2 | ||||
-rw-r--r-- | crates/mbe/src/syntax_bridge.rs | 5 |
3 files changed, 10 insertions, 7 deletions
diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs index 49841c7a1..a5750d829 100644 --- a/crates/hir_expand/src/name.rs +++ b/crates/hir_expand/src/name.rs | |||
@@ -43,8 +43,8 @@ impl Name { | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /// Shortcut to create inline plain text name | 45 | /// Shortcut to create inline plain text name |
46 | const fn new_inline_ascii(text: &[u8]) -> Name { | 46 | const fn new_inline(text: &str) -> Name { |
47 | Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text)) | 47 | Name::new_text(SmolStr::new_inline(text)) |
48 | } | 48 | } |
49 | 49 | ||
50 | /// Resolve a name from the text of token. | 50 | /// Resolve a name from the text of token. |
@@ -127,7 +127,7 @@ pub mod known { | |||
127 | $( | 127 | $( |
128 | #[allow(bad_style)] | 128 | #[allow(bad_style)] |
129 | pub const $ident: super::Name = | 129 | pub const $ident: super::Name = |
130 | super::Name::new_inline_ascii(stringify!($ident).as_bytes()); | 130 | super::Name::new_inline(stringify!($ident)); |
131 | )* | 131 | )* |
132 | }; | 132 | }; |
133 | } | 133 | } |
@@ -210,8 +210,8 @@ pub mod known { | |||
210 | ); | 210 | ); |
211 | 211 | ||
212 | // self/Self cannot be used as an identifier | 212 | // self/Self cannot be used as an identifier |
213 | pub const SELF_PARAM: 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_ascii(b"Self"); | 214 | pub const SELF_TYPE: super::Name = super::Name::new_inline("Self"); |
215 | 215 | ||
216 | #[macro_export] | 216 | #[macro_export] |
217 | macro_rules! name { | 217 | macro_rules! name { |
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 2b53b8297..9a7785c76 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
@@ -555,7 +555,7 @@ impl<'a> InferenceContext<'a> { | |||
555 | 555 | ||
556 | fn resolve_lang_item(&self, name: &str) -> Option<LangItemTarget> { | 556 | fn resolve_lang_item(&self, name: &str) -> Option<LangItemTarget> { |
557 | let krate = self.resolver.krate()?; | 557 | 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); |
559 | self.db.lang_item(krate, name) | 559 | self.db.lang_item(krate, name) |
560 | } | 560 | } |
561 | 561 | ||
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs index a8ad917fb..d987b2500 100644 --- a/crates/mbe/src/syntax_bridge.rs +++ b/crates/mbe/src/syntax_bridge.rs | |||
@@ -636,7 +636,10 @@ impl<'a> TreeSink for TtTreeSink<'a> { | |||
636 | let (text, id) = match leaf { | 636 | let (text, id) = match leaf { |
637 | tt::Leaf::Ident(ident) => (ident.text.clone(), ident.id), | 637 | tt::Leaf::Ident(ident) => (ident.text.clone(), ident.id), |
638 | tt::Leaf::Punct(punct) => { | 638 | 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) | ||
640 | } | 643 | } |
641 | tt::Leaf::Literal(lit) => (lit.text.clone(), lit.id), | 644 | tt::Leaf::Literal(lit) => (lit.text.clone(), lit.id), |
642 | }; | 645 | }; |