mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Cleanup
This commit is contained in:
parent
dd0c3c41b9
commit
d06733efeb
3 changed files with 3 additions and 7 deletions
|
@ -38,7 +38,7 @@ pub struct GroupLabel(pub String);
|
||||||
impl AssistLabel {
|
impl AssistLabel {
|
||||||
pub(crate) fn new(label: String, id: AssistId) -> AssistLabel {
|
pub(crate) fn new(label: String, id: AssistId) -> AssistLabel {
|
||||||
// FIXME: make fields private, so that this invariant can't be broken
|
// FIXME: make fields private, so that this invariant can't be broken
|
||||||
assert!(label.chars().next().unwrap().is_uppercase());
|
assert!(label.starts_with(|c: char| c.is_uppercase()));
|
||||||
AssistLabel { label, id }
|
AssistLabel { label, id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,11 +135,7 @@ impl Completions {
|
||||||
let (before, after) = (&docs[..idx], &docs[idx + s.len()..]);
|
let (before, after) = (&docs[..idx], &docs[idx + s.len()..]);
|
||||||
// Ensure to match the full word
|
// Ensure to match the full word
|
||||||
if after.starts_with('!')
|
if after.starts_with('!')
|
||||||
&& before
|
&& !before.ends_with(|c: char| c == '_' || c.is_ascii_alphanumeric())
|
||||||
.chars()
|
|
||||||
.rev()
|
|
||||||
.next()
|
|
||||||
.map_or(true, |c| c != '_' && !c.is_ascii_alphanumeric())
|
|
||||||
{
|
{
|
||||||
// It may have spaces before the braces like `foo! {}`
|
// It may have spaces before the braces like `foo! {}`
|
||||||
match after[1..].chars().find(|&c| !c.is_whitespace()) {
|
match after[1..].chars().find(|&c| !c.is_whitespace()) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ fn convert_literal(l: &tt::Literal) -> TtToken {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn convert_ident(ident: &tt::Ident) -> TtToken {
|
fn convert_ident(ident: &tt::Ident) -> TtToken {
|
||||||
let kind = if let Some('\'') = ident.text.chars().next() {
|
let kind = if ident.text.starts_with('\'') {
|
||||||
LIFETIME
|
LIFETIME
|
||||||
} else {
|
} else {
|
||||||
SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT)
|
SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT)
|
||||||
|
|
Loading…
Reference in a new issue