Skip to content

Commit d06733e

Browse files
committed
Cleanup
1 parent dd0c3c4 commit d06733e

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

crates/ra_assists/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct GroupLabel(pub String);
3838
impl AssistLabel {
3939
pub(crate) fn new(label: String, id: AssistId) -> AssistLabel {
4040
// FIXME: make fields private, so that this invariant can't be broken
41-
assert!(label.chars().next().unwrap().is_uppercase());
41+
assert!(label.starts_with(|c: char| c.is_uppercase()));
4242
AssistLabel { label, id }
4343
}
4444
}

crates/ra_ide/src/completion/presentation.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ impl Completions {
135135
let (before, after) = (&docs[..idx], &docs[idx + s.len()..]);
136136
// Ensure to match the full word
137137
if after.starts_with('!')
138-
&& before
139-
.chars()
140-
.rev()
141-
.next()
142-
.map_or(true, |c| c != '_' && !c.is_ascii_alphanumeric())
138+
&& !before.ends_with(|c: char| c == '_' || c.is_ascii_alphanumeric())
143139
{
144140
// It may have spaces before the braces like `foo! {}`
145141
match after[1..].chars().find(|&c| !c.is_whitespace()) {

crates/ra_mbe/src/subtree_source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn convert_literal(l: &tt::Literal) -> TtToken {
141141
}
142142

143143
fn convert_ident(ident: &tt::Ident) -> TtToken {
144-
let kind = if let Some('\'') = ident.text.chars().next() {
144+
let kind = if ident.text.starts_with('\'') {
145145
LIFETIME
146146
} else {
147147
SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT)

0 commit comments

Comments
 (0)