fmt: simplify parse_count
This commit is contained in:
parent
f4bc9e6d57
commit
9c383deaa6
1 changed files with 3 additions and 4 deletions
|
@ -264,7 +264,7 @@ pub mod ct {
|
||||||
}
|
}
|
||||||
pub fn parse_count(s: &str, i: uint, lim: uint)
|
pub fn parse_count(s: &str, i: uint, lim: uint)
|
||||||
-> Parsed<Count> {
|
-> Parsed<Count> {
|
||||||
return if i >= lim {
|
if i >= lim {
|
||||||
Parsed::new(CountImplied, i)
|
Parsed::new(CountImplied, i)
|
||||||
} else if s[i] == '*' as u8 {
|
} else if s[i] == '*' as u8 {
|
||||||
let param = parse_parameter(s, i + 1, lim);
|
let param = parse_parameter(s, i + 1, lim);
|
||||||
|
@ -274,15 +274,14 @@ pub mod ct {
|
||||||
Some(n) => Parsed::new(CountIsParam(n), j)
|
Some(n) => Parsed::new(CountIsParam(n), j)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let num = peek_num(s, i, lim);
|
match peek_num(s, i, lim) {
|
||||||
match num {
|
|
||||||
None => Parsed::new(CountImplied, i),
|
None => Parsed::new(CountImplied, i),
|
||||||
Some(num) => Parsed::new(
|
Some(num) => Parsed::new(
|
||||||
CountIs(num.val),
|
CountIs(num.val),
|
||||||
num.next
|
num.next
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
pub fn parse_precision(s: &str, i: uint, lim: uint) ->
|
pub fn parse_precision(s: &str, i: uint, lim: uint) ->
|
||||||
Parsed<Count> {
|
Parsed<Count> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue