]> git.lizzy.rs Git - rust.git/commitdiff
Bump smol_str from 0.1.16 to 0.1.17
authorJean SIMARD <woshilapin@tuziwo.info>
Wed, 23 Sep 2020 06:45:35 +0000 (08:45 +0200)
committerJean SIMARD <woshilapin@tuziwo.info>
Thu, 24 Sep 2020 14:39:08 +0000 (16:39 +0200)
Cargo.lock
crates/hir_expand/src/name.rs
crates/hir_ty/src/infer.rs
crates/mbe/src/syntax_bridge.rs

index 7fecee1b57deb4651b8bca3d1866e3e2408e4820..85839bf477b8b46ddc2ebeec42c39e03e8307536 100644 (file)
@@ -1465,9 +1465,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
 
 [[package]]
 name = "smol_str"
-version = "0.1.16"
+version = "0.1.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f7909a1d8bc166a862124d84fdc11bda0ea4ed3157ccca662296919c2972db1"
+checksum = "6ca0f7ce3a29234210f0f4f0b56f8be2e722488b95cb522077943212da3b32eb"
 dependencies = [
  "serde",
 ]
index 49841c7a124fcd655507ffe73492416675d5c7c5..a5750d829a4d1ef49813d3942c773642b5f7b209 100644 (file)
@@ -43,8 +43,8 @@ pub fn new_lifetime(lt: &syntax::SyntaxToken) -> Name {
     }
 
     /// Shortcut to create inline plain text name
-    const fn new_inline_ascii(text: &[u8]) -> Name {
-        Name::new_text(SmolStr::new_inline_from_ascii(text.len(), text))
+    const fn new_inline(text: &str) -> Name {
+        Name::new_text(SmolStr::new_inline(text))
     }
 
     /// Resolve a name from the text of token.
@@ -127,7 +127,7 @@ macro_rules! known_names {
             $(
                 #[allow(bad_style)]
                 pub const $ident: super::Name =
-                    super::Name::new_inline_ascii(stringify!($ident).as_bytes());
+                    super::Name::new_inline(stringify!($ident));
             )*
         };
     }
@@ -210,8 +210,8 @@ macro_rules! known_names {
     );
 
     // self/Self cannot be used as an identifier
-    pub const SELF_PARAM: super::Name = super::Name::new_inline_ascii(b"self");
-    pub const SELF_TYPE: super::Name = super::Name::new_inline_ascii(b"Self");
+    pub const SELF_PARAM: super::Name = super::Name::new_inline("self");
+    pub const SELF_TYPE: super::Name = super::Name::new_inline("Self");
 
     #[macro_export]
     macro_rules! name {
index 2b53b8297314941f5b917917ff7939d908b83bfc..9a7785c763d856befd169286f49176322dabc85c 100644 (file)
@@ -555,7 +555,7 @@ fn infer_body(&mut self) {
 
     fn resolve_lang_item(&self, name: &str) -> Option<LangItemTarget> {
         let krate = self.resolver.krate()?;
-        let name = SmolStr::new_inline_from_ascii(name.len(), name.as_bytes());
+        let name = SmolStr::new_inline(name);
         self.db.lang_item(krate, name)
     }
 
index a8ad917fb880c534faffe1df3baca75febd8122d..d987b2500442b8d1cfca4e0b1e82e352e32316f1 100644 (file)
@@ -636,7 +636,10 @@ fn token(&mut self, kind: SyntaxKind, mut n_tokens: u8) {
                     let (text, id) = match leaf {
                         tt::Leaf::Ident(ident) => (ident.text.clone(), ident.id),
                         tt::Leaf::Punct(punct) => {
-                            (SmolStr::new_inline_from_ascii(1, &[punct.char as u8]), punct.id)
+                            assert!(punct.char.is_ascii());
+                            let char = &(punct.char as u8);
+                            let text = std::str::from_utf8(std::slice::from_ref(char)).unwrap();
+                            (SmolStr::new_inline(text), punct.id)
                         }
                         tt::Leaf::Literal(lit) => (lit.text.clone(), lit.id),
                     };