fixed most warnings
This commit is contained in:
parent
e931d9a825
commit
21f0682500
10 changed files with 116 additions and 154 deletions
|
@ -14,7 +14,7 @@ pub(super) fn take_until<'a>(word : &'a str, pattern : u8) -> ParseResult<'a> {
|
|||
let mut new_start = 0;
|
||||
|
||||
for chr in word.as_bytes() {
|
||||
if (*chr == pattern) {
|
||||
if *chr == pattern {
|
||||
break
|
||||
}
|
||||
else {
|
||||
|
@ -30,25 +30,11 @@ pub(super) fn take_until<'a>(word : &'a str, pattern : u8) -> ParseResult<'a> {
|
|||
|
||||
}
|
||||
|
||||
// TODO: if I end up using simulator specific date parsers, ``take_until`` may
|
||||
// suffice rendering this function obselete, at which point I should delete it.
|
||||
pub(super) fn truncate_last_chr_when<'a>(word : &'a str, cond : fn(u8) -> bool) -> &'a str {
|
||||
let last_chr = word.as_bytes().last().unwrap();
|
||||
let mut new_end_index = word.len();
|
||||
|
||||
if cond(*last_chr) {
|
||||
new_end_index -= 1;
|
||||
}
|
||||
|
||||
return &word[0..new_end_index]
|
||||
|
||||
}
|
||||
|
||||
pub(super) fn take_while<'a>(word : &'a str, cond : fn(u8) -> bool) -> ParseResult<'a> {
|
||||
let mut new_start = 0;
|
||||
|
||||
for chr in word.as_bytes() {
|
||||
if (cond(*chr)) {
|
||||
if cond(*chr) {
|
||||
new_start += 1;
|
||||
}
|
||||
else {
|
||||
|
|
Reference in a new issue