Fix clippy issues
All checks were successful
/ build-upload (push) Successful in 55s

This commit is contained in:
Tobias Reisinger 2024-04-10 17:40:51 +02:00
parent ae411b6dcc
commit ea7815535c
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
3 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@ pub fn register_events(connection: &mut Telnet, events: Vec<EventType>) -> Resul
pub fn handle_event_response(connection: &mut Telnet, response: Response, known_clients: &mut Vec<Client>) {
if let Response::Event(event_type, params) = response {
let event = Event::new(connection, event_type, params, &known_clients);
let event = Event::new(connection, event_type, params, known_clients);
match serde_json::to_string(&event) {
Ok(json) => println!("{}", json),
Err(err) => {

View file

@ -5,7 +5,7 @@ pub type ParameterList = HashMap<String, String>;
pub type Parameter = (String, String);
pub fn parameter_find(params: &ParameterList, name: &str) -> Option<String> {
params.get(name).map(|value| value.clone())
params.get(name).cloned()
}
pub fn parameter_list_has(params: &ParameterList, key: &str, value: &str, strict: bool) -> bool {
@ -17,7 +17,7 @@ pub fn parameter_list_has(params: &ParameterList, key: &str, value: &str, strict
return true;
}
}
return false;
false
}
pub fn parameter_list_find(param_lists: &Vec<ParameterList>, key: &str, value: &str, strict: bool) -> Option<ParameterList> {
@ -58,7 +58,7 @@ pub fn parameter_to_string(param: Parameter) -> String {
pub fn parameter_list_to_string(parameter_list: ParameterList, sep: &str) -> String {
parameter_list
.into_iter()
.map(|param| parameter_to_string(param))
.map(parameter_to_string)
.collect::<Vec<String>>()
.join(sep)
}
@ -66,7 +66,7 @@ pub fn parameter_list_to_string(parameter_list: ParameterList, sep: &str) -> Str
pub fn parameters_to_string(parameters: Vec<Parameter>, sep: &str) -> String {
parameters
.into_iter()
.map(|param| parameter_to_string(param))
.map(parameter_to_string)
.collect::<Vec<String>>()
.join(sep)
}

View file

@ -45,7 +45,7 @@ fn get_response_type(type_str: &str) -> Result<ResponseType, String> {
return Ok(ResponseType::Event(event_type));
}
return Ok(ResponseType::Unknown);
Ok(ResponseType::Unknown)
}
impl TryFrom<String> for Response {
@ -54,7 +54,7 @@ impl TryFrom<String> for Response {
fn try_from(response_str: String) -> Result<Self, ResponseError> {
let response_str = response_str.trim_end_matches("\n\r");
let (rsp_type, rsp_params) = split_type_and_params(&response_str)
let (rsp_type, rsp_params) = split_type_and_params(response_str)
.map_err(|err| ResponseError {
id: -1,
msg: err,
@ -66,7 +66,7 @@ impl TryFrom<String> for Response {
parameter_lists.push(response_params);
}
return match rsp_type {
match rsp_type {
ResponseType::Error => {
Err(ResponseError::create_error(&parameter_lists[0]))
}