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

Commit

Permalink
Fix clippy warnings/errors introduced by Rust 1.70 (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
argerus authored Sep 5, 2023
1 parent 9b7861d commit 80d482d
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 199 deletions.
35 changes: 7 additions & 28 deletions kuksa_databroker/databroker-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,10 +1467,7 @@ mod test {
try_into_data_value("false", proto::v1::DataType::Bool),
Ok(proto::v1::datapoint::Value::BoolValue(value)) if !value
));
assert!(matches!(
try_into_data_value("truefalse", proto::v1::DataType::Bool),
Err(_)
));
assert!(try_into_data_value("truefalse", proto::v1::DataType::Bool).is_err());
// BoolArray
assert!(matches!(
try_into_data_value("[true, false, true]", proto::v1::DataType::BoolArray),
Expand All @@ -1486,18 +1483,9 @@ mod test {
try_into_data_value("-100", proto::v1::DataType::Int8),
Ok(proto::v1::datapoint::Value::Int32Value(value)) if value == -100
));
assert!(matches!(
try_into_data_value("300", proto::v1::DataType::Int8),
Err(_)
));
assert!(matches!(
try_into_data_value("-300", proto::v1::DataType::Int8),
Err(_)
));
assert!(matches!(
try_into_data_value("-100.1", proto::v1::DataType::Int8),
Err(_)
));
assert!(try_into_data_value("300", proto::v1::DataType::Int8).is_err());
assert!(try_into_data_value("-300", proto::v1::DataType::Int8).is_err());
assert!(try_into_data_value("-100.1", proto::v1::DataType::Int8).is_err());

// Int16
assert!(matches!(
Expand All @@ -1516,18 +1504,9 @@ mod test {
try_into_data_value("-32000", proto::v1::DataType::Int16),
Ok(proto::v1::datapoint::Value::Int32Value(value)) if value == -32000
));
assert!(matches!(
try_into_data_value("33000", proto::v1::DataType::Int16),
Err(_)
));
assert!(matches!(
try_into_data_value("-33000", proto::v1::DataType::Int16),
Err(_)
));
assert!(matches!(
try_into_data_value("-32000.1", proto::v1::DataType::Int16),
Err(_)
));
assert!(try_into_data_value("33000", proto::v1::DataType::Int16).is_err());
assert!(try_into_data_value("-33000", proto::v1::DataType::Int16).is_err());
assert!(try_into_data_value("-32000.1", proto::v1::DataType::Int16).is_err());
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions kuksa_databroker/databroker/src/query/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn executor_test() {
DataValue::NotAvailable,
),
];
assert!(matches!(res, Some(_)));
assert!(res.is_some());
if let Some(fields) = &res {
assert_eq!(fields.len(), 2);
for (i, (name, value)) in fields.iter().enumerate() {
Expand All @@ -396,5 +396,5 @@ fn executor_test() {
};
let res = compiled_query.execute(&execution_input1).unwrap();

assert!(matches!(res, None));
assert!(res.is_none());
}
Loading

0 comments on commit 80d482d

Please sign in to comment.