mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 05:47:53 +00:00
refactor(commands): remove some unnecessary branching
This commit is contained in:
parent
07b616e422
commit
4f390e2a14
1 changed files with 0 additions and 14 deletions
|
|
@ -246,13 +246,6 @@ fn match_flag<'a>(
|
|||
possible_flags: impl Iterator<Item = &'a Flag>,
|
||||
matched_flag: MatchedFlag<'a>,
|
||||
) -> Option<Result<(SmolStr, Option<Parameter>), (&'a Flag, FlagMatchError)>> {
|
||||
// skip if 0 length (we could just take an array ref here and in next_token aswell but its nice to keep it flexible)
|
||||
if let (_, Some(len)) = possible_flags.size_hint()
|
||||
&& len == 0
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
// check for all (possible) flags, see if token matches
|
||||
for flag in possible_flags {
|
||||
println!("matching flag {flag:?}");
|
||||
|
|
@ -279,13 +272,6 @@ fn next_token<'a>(
|
|||
input: &str,
|
||||
current_pos: usize,
|
||||
) -> Option<Result<(&'a Token, Option<TokenMatchValue>, usize), (&'a Token, TokenMatchError)>> {
|
||||
// skip if 0 length
|
||||
if let (_, Some(len)) = possible_tokens.size_hint()
|
||||
&& len == 0
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
// get next parameter, matching quotes
|
||||
let matched = string::next_param(&input, current_pos);
|
||||
println!("matched: {matched:?}\n---");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue