File tree Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Expand file tree Collapse file tree 3 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ pub struct GroupLabel(pub String);
38
38
impl AssistLabel {
39
39
pub ( crate ) fn new ( label : String , id : AssistId ) -> AssistLabel {
40
40
// 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( ) ) ) ;
42
42
AssistLabel { label, id }
43
43
}
44
44
}
Original file line number Diff line number Diff line change @@ -135,11 +135,7 @@ impl Completions {
135
135
let ( before, after) = ( & docs[ ..idx] , & docs[ idx + s. len ( ) ..] ) ;
136
136
// Ensure to match the full word
137
137
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 ( ) )
143
139
{
144
140
// It may have spaces before the braces like `foo! {}`
145
141
match after[ 1 ..] . chars ( ) . find ( |& c| !c. is_whitespace ( ) ) {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ fn convert_literal(l: &tt::Literal) -> TtToken {
141
141
}
142
142
143
143
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 ( '\'' ) {
145
145
LIFETIME
146
146
} else {
147
147
SyntaxKind :: from_keyword ( ident. text . as_str ( ) ) . unwrap_or ( IDENT )
You can’t perform that action at this time.
0 commit comments