Refactor response_classes and fix clippy issues
This commit is contained in:
parent
244a7073fe
commit
463bc99b9c
8 changed files with 139 additions and 133 deletions
src
|
@ -18,7 +18,7 @@ pub fn parameter_find(params: &Vec<Parameter>, name: &str) -> Option<Parameter>
|
|||
}
|
||||
pub fn parameter_list_find(param_lists: &Vec<ParameterList>, name: &str, value: &str, strict: bool) -> Option<ParameterList> {
|
||||
for params in param_lists {
|
||||
if params.iter().position(|param| param.is(name, value, strict)).is_some() {
|
||||
if params.iter().any(|param| param.is(name, value, strict)) {
|
||||
return Some(params.clone());
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ pub fn parameter_list_find(param_lists: &Vec<ParameterList>, name: &str, value:
|
|||
pub fn parameter_list_find_all(param_lists: &Vec<ParameterList>, name: &str, value: &str, strict: bool) -> Vec<ParameterList> {
|
||||
let mut found = Vec::new();
|
||||
for params in param_lists {
|
||||
if params.iter().position(|param| param.is(name, value, strict)).is_some() {
|
||||
if params.iter().any(|param| param.is(name, value, strict)) {
|
||||
found.push(params.clone())
|
||||
}
|
||||
}
|
||||
|
@ -65,17 +65,15 @@ impl Parameter {
|
|||
|
||||
pub fn is(&self, name: &str, value: &str, strict: bool) -> bool {
|
||||
if self.name != name {
|
||||
false
|
||||
return false;
|
||||
}
|
||||
else if self.value != value && strict {
|
||||
false
|
||||
if self.value != value && strict {
|
||||
return false;
|
||||
}
|
||||
else if !self.value.contains(value) && !strict {
|
||||
false
|
||||
}
|
||||
else {
|
||||
true
|
||||
if !self.value.contains(value) && !strict {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub fn to_i32(&self, default: i32) -> i32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue