Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Fix clippy findings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag committed Nov 15, 2023
1 parent 97fdf86 commit f326915
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions kuksa_databroker/databroker/tests/read_write_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ fn assert_current_value_unauthenticated(w: &mut DataBrokerWorld) {
if let Some(error) = w.current_client_error.clone() {
match error {
ClientError::Connection(e) => {
assert!(false, "No connection error {:?} should occcur", e)
panic!("No connection error {:?} should occcur", e)
}
ClientError::Function(e) => assert!(false, "No function error {:?} should occur", e),
ClientError::Function(e) => panic!("No function error {:?} should occur", e),
ClientError::Status(status) => assert_eq!(status.code(), Code::Unauthenticated),
}
}
Expand Down
20 changes: 9 additions & 11 deletions kuksa_databroker/databroker/tests/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ impl DataBrokerWorld {
/// https://github.com/grpc/grpc/blob/master/doc/statuscodes.md#status-codes-and-their-use-in-grpc
pub fn assert_status_has_code(&self, expected_status_code: i32) {
match &self.current_client_error {
Some(ClientError::Connection(_)) => assert!(false, "Connection error shall not occur"),
Some(ClientError::Connection(_)) => panic!("Connection error shall not occur"),
Some(ClientError::Function(_)) => {
assert!(false, "Fucntion has an error that shall not occur")
panic!("Fucntion has an error that shall not occur")
}
Some(ClientError::Status(status)) => {
assert_eq!(status.code(), Code::from_i32(expected_status_code))
}
None => assert!(false, "No error, but an errror is expected"),
None => panic!("No error, but an errror is expected"),
}
}

Expand All @@ -310,15 +310,15 @@ impl DataBrokerWorld {

if let Some(client_error) = self.current_client_error.clone() {
match client_error {
ClientError::Connection(_) => assert!(false, "response contains connection error"),
ClientError::Connection(_) => panic!("response contains connection error"),
ClientError::Function(e) => {
for element in e {
if !code.contains(&element.code) {
code.push(element.code)
}
}
}
ClientError::Status(_) => assert!(false, "response contains channel error"),
ClientError::Status(_) => panic!("response contains channel error"),
}

assert!(
Expand All @@ -328,25 +328,23 @@ impl DataBrokerWorld {
);
assert_eq!(code, error_codes, "response contains unexpected error code");
} else {
assert!(false, "response contains no error code");
panic!("response contains no error code");
}
}

pub fn assert_set_succeeded(&self) {
if let Some(error) = self.current_client_error.clone() {
match error {
ClientError::Connection(e) => {
assert!(false, "No connection error {:?} should occcur", e)
panic!("No connection error {:?} should occcur", e)
}
ClientError::Function(e) => {
assert!(false, "No function error {:?} should occur", e)
panic!("No function error {:?} should occur", e)
}
ClientError::Status(status) => {
assert!(false, "No status error {:?} should occur", status)
panic!("No status error {:?} should occur", status)
}
}
} else {
assert!(true, "Succeeded")
}
}
}

0 comments on commit f326915

Please sign in to comment.