refactor: fix clippy error

This commit is contained in:
ClementTsang 2020-05-21 21:46:21 -04:00
parent b33ea11af2
commit c7edad91ed

View File

@ -163,8 +163,7 @@ impl ProcessQuery for ProcWidgetState {
compare_prefix: None, compare_prefix: None,
}); });
} }
} else { } else if queue_top == "(" {
if queue_top == "(" {
if query.is_empty() { if query.is_empty() {
return Err(QueryError("Missing closing parentheses".into())); return Err(QueryError("Missing closing parentheses".into()));
} }
@ -257,10 +256,7 @@ impl ProcessQuery for ProcWidgetState {
PrefixType::Name => { PrefixType::Name => {
return Ok(Prefix { return Ok(Prefix {
or: None, or: None,
regex_prefix: Some(( regex_prefix: Some((prefix_type, StringQuery::Value(content))),
prefix_type,
StringQuery::Value(content),
)),
compare_prefix: None, compare_prefix: None,
}) })
} }
@ -345,8 +341,7 @@ impl ProcessQuery for ProcWidgetState {
| PrefixType::TRead | PrefixType::TRead
| PrefixType::TWrite => { | PrefixType::TWrite => {
if let Some(potential_unit) = query.front() { if let Some(potential_unit) = query.front() {
match potential_unit.to_lowercase().as_str() match potential_unit.to_lowercase().as_str() {
{
"tb" => { "tb" => {
value *= 1_000_000_000_000.0; value *= 1_000_000_000_000.0;
query.pop_front(); query.pop_front();
@ -406,7 +401,6 @@ impl ProcessQuery for ProcWidgetState {
return Err(QueryError("Missing argument for search prefix".into())); return Err(QueryError("Missing argument for search prefix".into()));
} }
} }
}
} else if inside_quotation { } else if inside_quotation {
// Uh oh, it's empty with quotes! // Uh oh, it's empty with quotes!
return Err(QueryError("Missing closing quotation".into())); return Err(QueryError("Missing closing quotation".into()));