File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -344,8 +344,15 @@ where
344
344
{
345
345
let mut cursor = input;
346
346
let mut ofs = 0 ;
347
- while let Some ( ( pos, b) ) = cursor. iter ( ) . enumerate ( ) . find ( |( _, b) | {
348
- if b"@~^:." . contains ( b) {
347
+ while let Some ( ( pos, b) ) = cursor. iter ( ) . enumerate ( ) . find ( |( pos, b) | {
348
+ if * * b == b'@' {
349
+ cursor. get ( pos + 1 ) == Some ( & b'{' )
350
+ || cursor
351
+ . get ( pos + 1 )
352
+ . and_then ( |b| Some ( b"~^:." . contains ( b) ) )
353
+ . unwrap_or ( false )
354
+ || ( * pos == 0 && cursor. get ( 1 ) == None )
355
+ } else if b"~^:." . contains ( b) {
349
356
true
350
357
} else {
351
358
if let Some ( num) = consecutive_hex_chars. as_mut ( ) {
Original file line number Diff line number Diff line change @@ -10,15 +10,10 @@ fn at_by_itself_is_shortcut_for_head() {
10
10
}
11
11
12
12
#[ test]
13
- fn multiple_ats_are_invalid_but_may_cause_callbacks ( ) {
14
- let err = try_parse ( "@@" ) . unwrap_err ( ) ;
15
- assert ! ( matches!( err, spec:: parse:: Error :: AtNeedsCurlyBrackets { input} if input == "@" ) ) ;
16
- }
17
-
18
- #[ test]
19
- fn lonely_at_after_ref_is_invalid ( ) {
20
- let err = try_parse ( "HEAD@" ) . unwrap_err ( ) ;
21
- assert ! ( matches!( err, spec:: parse:: Error :: AtNeedsCurlyBrackets { input} if input == "@" ) ) ;
13
+ fn at_is_allowed ( ) {
14
+ let rec = parse ( "a@b" ) ;
15
+ assert ! ( rec. kind. is_none( ) ) ;
16
+ assert_eq ! ( rec. get_ref( 0 ) , "a@b" ) ;
22
17
}
23
18
24
19
#[ test]
You can’t perform that action at this time.
0 commit comments