File tree 3 files changed +8
-5
lines changed
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -348,18 +348,18 @@ impl Ini {
348
348
continue ;
349
349
}
350
350
match trimmed. find ( '[' ) {
351
- Some ( start ) => match trimmed. rfind ( ']' ) {
351
+ Some ( 0 ) => match trimmed. rfind ( ']' ) {
352
352
Some ( end) => {
353
- section = caser ( trimmed[ start + 1 ..end] . trim ( ) ) ;
353
+ section = caser ( trimmed[ 1 ..end] . trim ( ) ) ;
354
354
}
355
355
None => {
356
356
return Err ( format ! (
357
- "line {}:{}: Found opening bracket for section name but no closing bracket" ,
358
- num, start
357
+ "line {}: Found opening bracket for section name but no closing bracket" ,
358
+ num
359
359
) ) ;
360
360
}
361
361
} ,
362
- None => match trimmed. find ( & self . delimiters [ ..] ) {
362
+ Some ( _ ) | None => match trimmed. find ( & self . delimiters [ ..] ) {
363
363
Some ( delimiter) => match map. get_mut ( & section) {
364
364
Some ( valmap) => {
365
365
let key = caser ( trimmed[ ..delimiter] . trim ( ) ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ KFC = the secret herb is orega-
5
5
colon:value after colon
6
6
Empty string =
7
7
None string
8
+ Password =[in-brackets]
8
9
9
10
[ spacing ]
10
11
indented =indented
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ fn non_cs() -> Result<(), Box<dyn Error>> {
13
13
colon:value after colon
14
14
Empty string =
15
15
None string
16
+ Password=[in-brackets]
16
17
[ spacing ]
17
18
indented=indented
18
19
not indented = not indented ;testcomment
@@ -116,6 +117,7 @@ fn cs() -> Result<(), Box<dyn Error>> {
116
117
colon:value after colon
117
118
Empty string =
118
119
None string
120
+ Password=[in-brackets]
119
121
[ spacing ]
120
122
indented=indented
121
123
not indented = not indented ;testcomment
You can’t perform that action at this time.
0 commit comments