Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #14548 - Veykril:smol-str, r=Veykril
minor: Bump smol-str
bors 2023-04-11
parent 7afd204 · parent 1456b53 · commit a1af8bb
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml1
-rw-r--r--crates/ide-completion/src/completions/env_vars.rs4
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--crates/syntax/src/token_text.rs7
-rw-r--r--crates/tt/Cargo.toml2
6 files changed, 14 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a8f5674efb..9d082215e8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1642,9 +1642,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "smol_str"
-version = "0.1.25"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d268d24892b932cac466d214af6ec8a3ec99873f0f8664d9a384b49596db682"
+checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c"
dependencies = [
"serde",
]
diff --git a/Cargo.toml b/Cargo.toml
index 511cb24a61..985a1844c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -77,6 +77,7 @@ vfs = { path = "./crates/vfs", version = "0.0.0" }
# non-local crates
smallvec = { version = "1.10.0", features = ["const_new", "union", "const_generics"] }
+smol_str = "0.2.0"
# the following crates are pinned to prevent us from pulling in syn 2 until all our dependencies have moved
serde = { version = "=1.0.156", features = ["derive"] }
serde_json = "1.0.94"
diff --git a/crates/ide-completion/src/completions/env_vars.rs b/crates/ide-completion/src/completions/env_vars.rs
index 1002be2113..c525e0c807 100644
--- a/crates/ide-completion/src/completions/env_vars.rs
+++ b/crates/ide-completion/src/completions/env_vars.rs
@@ -37,9 +37,9 @@ pub(crate) fn complete_cargo_env_vars(
guard_env_macro(expanded, &ctx.sema)?;
let range = expanded.text_range_between_quotes()?;
- CARGO_DEFINED_VARS.iter().for_each(|(var, detail)| {
+ CARGO_DEFINED_VARS.into_iter().for_each(|&(var, detail)| {
let mut item = CompletionItem::new(CompletionItemKind::Keyword, range, var);
- item.detail(*detail);
+ item.detail(detail);
item.add_to(acc);
});
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index 7200df0a57..9109507f75 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -21,7 +21,7 @@ rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" }
rustc-hash = "1.1.0"
once_cell = "1.17.0"
indexmap = "1.9.1"
-smol_str = "0.1.23"
+smol_str.workspace = true
parser.workspace = true
profile.workspace = true
diff --git a/crates/syntax/src/token_text.rs b/crates/syntax/src/token_text.rs
index 913b24d42b..09c080c0c2 100644
--- a/crates/syntax/src/token_text.rs
+++ b/crates/syntax/src/token_text.rs
@@ -3,6 +3,7 @@
use std::{cmp::Ordering, fmt, ops};
use rowan::GreenToken;
+use smol_str::SmolStr;
pub struct TokenText<'a>(pub(crate) Repr<'a>);
@@ -47,6 +48,12 @@ impl From<TokenText<'_>> for String {
}
}
+impl From<TokenText<'_>> for SmolStr {
+ fn from(token_text: TokenText<'_>) -> Self {
+ SmolStr::new(token_text.as_str())
+ }
+}
+
impl PartialEq<&'_ str> for TokenText<'_> {
fn eq(&self, other: &&str) -> bool {
self.as_str() == *other
diff --git a/crates/tt/Cargo.toml b/crates/tt/Cargo.toml
index b846938318..a28ee5f1ca 100644
--- a/crates/tt/Cargo.toml
+++ b/crates/tt/Cargo.toml
@@ -12,6 +12,6 @@ rust-version.workspace = true
doctest = false
[dependencies]
-smol_str = "0.1.23"
+smol_str.workspace = true
stdx.workspace = true