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

View file

@ -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

View file

@ -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