Bump smol-str

This commit is contained in:
Lukas Wirth 2023-04-11 14:05:22 +02:00
parent fa3db447d7
commit 1456b53051
6 changed files with 14 additions and 6 deletions

4
Cargo.lock generated
View file

@ -1642,9 +1642,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "smol_str" name = "smol_str"
version = "0.1.25" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d268d24892b932cac466d214af6ec8a3ec99873f0f8664d9a384b49596db682" checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c"
dependencies = [ dependencies = [
"serde", "serde",
] ]

View file

@ -77,6 +77,7 @@ vfs = { path = "./crates/vfs", version = "0.0.0" }
# non-local crates # non-local crates
smallvec = { version = "1.10.0", features = ["const_new", "union", "const_generics"] } 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 # 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 = { version = "=1.0.156", features = ["derive"] }
serde_json = "1.0.94" serde_json = "1.0.94"

View file

@ -37,9 +37,9 @@ pub(crate) fn complete_cargo_env_vars(
guard_env_macro(expanded, &ctx.sema)?; guard_env_macro(expanded, &ctx.sema)?;
let range = expanded.text_range_between_quotes()?; 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); let mut item = CompletionItem::new(CompletionItemKind::Keyword, range, var);
item.detail(*detail); item.detail(detail);
item.add_to(acc); item.add_to(acc);
}); });

View file

@ -21,7 +21,7 @@ rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
once_cell = "1.17.0" once_cell = "1.17.0"
indexmap = "1.9.1" indexmap = "1.9.1"
smol_str = "0.1.23" smol_str.workspace = true
parser.workspace = true parser.workspace = true
profile.workspace = true profile.workspace = true

View file

@ -3,6 +3,7 @@
use std::{cmp::Ordering, fmt, ops}; use std::{cmp::Ordering, fmt, ops};
use rowan::GreenToken; use rowan::GreenToken;
use smol_str::SmolStr;
pub struct TokenText<'a>(pub(crate) Repr<'a>); 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<'_> { impl PartialEq<&'_ str> for TokenText<'_> {
fn eq(&self, other: &&str) -> bool { fn eq(&self, other: &&str) -> bool {
self.as_str() == *other self.as_str() == *other

View file

@ -12,6 +12,6 @@ rust-version.workspace = true
doctest = false doctest = false
[dependencies] [dependencies]
smol_str = "0.1.23" smol_str.workspace = true
stdx.workspace = true stdx.workspace = true