From 4cad8e767a7d67e0338cdf5da8d8cee4edb16d92 Mon Sep 17 00:00:00 2001 From: Jake Gallow Date: Thu, 27 Jan 2022 12:13:50 -0600 Subject: [PATCH] fix all clippy errors and update versions (#442) --- .github/workflows/check-rust.yml | 4 ++- Cargo.lock | 28 +++++++++---------- agent/Cargo.toml | 2 +- agent/src/util/device_plugin_builder.rs | 8 ++++-- agent/src/util/device_plugin_service.rs | 15 +++++----- agent/src/util/discovery_operator.rs | 2 +- agent/src/util/registration.rs | 3 +- controller/Cargo.toml | 2 +- controller/src/util/instance_action.rs | 3 +- controller/src/util/node_watcher.rs | 2 +- controller/src/util/pod_watcher.rs | 5 ++++ controller/src/util/shared_test_utils.rs | 2 +- deployment/helm/Chart.yaml | 4 +-- .../debug-echo-discovery-handler/Cargo.toml | 2 +- .../onvif-discovery-handler/Cargo.toml | 2 +- .../opcua-discovery-handler/Cargo.toml | 2 +- .../udev-discovery-handler/Cargo.toml | 2 +- discovery-handlers/debug-echo/Cargo.toml | 2 +- discovery-handlers/onvif/Cargo.toml | 2 +- .../onvif/src/discovery_handler.rs | 4 +-- .../onvif/src/discovery_impl.rs | 2 +- .../onvif/src/discovery_utils.rs | 2 +- discovery-handlers/opcua/Cargo.toml | 2 +- discovery-handlers/udev/Cargo.toml | 2 +- discovery-handlers/udev/src/discovery_impl.rs | 1 + discovery-utils/Cargo.toml | 2 +- discovery-utils/src/discovery/mod.rs | 3 +- discovery-utils/src/filtering.rs | 24 ++++++---------- samples/brokers/udev-video-broker/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- shared/src/akri/configuration.rs | 2 +- shared/src/akri/instance.rs | 2 +- shared/src/k8s/mod.rs | 16 +++++------ shared/src/k8s/pod.rs | 1 + version.txt | 2 +- webhooks/validating/configuration/Cargo.toml | 2 +- webhooks/validating/configuration/src/main.rs | 20 ++++++------- 37 files changed, 96 insertions(+), 87 deletions(-) diff --git a/.github/workflows/check-rust.yml b/.github/workflows/check-rust.yml index 368350452..229ef8fc7 100644 --- a/.github/workflows/check-rust.yml +++ b/.github/workflows/check-rust.yml @@ -46,6 +46,8 @@ jobs: run: cargo fmt --all -- --check - name: Check clippy run: cargo clippy --all + - name: Check clippy for tests + run: cargo clippy --all-targets --all-features -- -D warnings - name: Run check run: cargo check - name: Check for H2 patch not being applied @@ -57,4 +59,4 @@ jobs: - name: Run tests --ignored run: cargo test -- --ignored - name: Run doc - run: cargo doc --no-deps + run: export RUSTDOCFLAGS="-Dwarnings" && cargo doc --no-deps diff --git a/Cargo.lock b/Cargo.lock index 2b31fc24e..4a7870711 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "agent" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -390,7 +390,7 @@ dependencies = [ [[package]] name = "akri-debug-echo" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -410,7 +410,7 @@ dependencies = [ [[package]] name = "akri-discovery-utils" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-shared", "anyhow", @@ -432,7 +432,7 @@ dependencies = [ [[package]] name = "akri-onvif" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -461,7 +461,7 @@ dependencies = [ [[package]] name = "akri-opcua" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-shared", @@ -485,7 +485,7 @@ dependencies = [ [[package]] name = "akri-shared" -version = "0.8.1" +version = "0.8.2" dependencies = [ "anyhow", "async-trait", @@ -514,7 +514,7 @@ dependencies = [ [[package]] name = "akri-udev" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "anyhow", @@ -980,7 +980,7 @@ checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" [[package]] name = "controller" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-shared", "anyhow", @@ -1195,7 +1195,7 @@ dependencies = [ [[package]] name = "debug-echo-discovery-handler" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-debug-echo", "akri-discovery-utils", @@ -2414,7 +2414,7 @@ checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "onvif-discovery-handler" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-onvif", @@ -2498,7 +2498,7 @@ dependencies = [ [[package]] name = "opcua-discovery-handler" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-opcua", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "udev-discovery-handler" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-discovery-utils", "akri-udev", @@ -4321,7 +4321,7 @@ dependencies = [ [[package]] name = "udev-video-broker" -version = "0.8.1" +version = "0.8.2" dependencies = [ "akri-shared", "env_logger", @@ -4585,7 +4585,7 @@ dependencies = [ [[package]] name = "webhook-configuration" -version = "0.8.1" +version = "0.8.2" dependencies = [ "actix", "actix-rt 2.5.1", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index cda768fbc..f7cbeaadb 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/agent/src/util/device_plugin_builder.rs b/agent/src/util/device_plugin_builder.rs index 0a208cb9d..907d10b49 100644 --- a/agent/src/util/device_plugin_builder.rs +++ b/agent/src/util/device_plugin_builder.rs @@ -140,7 +140,8 @@ impl DevicePluginBuilderInterface for DevicePluginBuilder { UnixListener::bind(task_socket_path).expect("Failed to bind to socket path"); async_stream::stream! { - while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + loop { + let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await; yield item; } } @@ -270,7 +271,8 @@ pub mod tests { let uds = UnixListener::bind(socket).expect("Failed to bind to socket path"); async_stream::stream! { - while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + loop { + let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await; yield item; } } @@ -348,7 +350,7 @@ pub mod tests { }); // Make sure registration server has started - akri_shared::uds::unix_stream::try_connect(&kubelet_socket_str) + akri_shared::uds::unix_stream::try_connect(kubelet_socket_str) .await .unwrap(); diff --git a/agent/src/util/device_plugin_service.rs b/agent/src/util/device_plugin_service.rs index f8db0d7b4..ec89c8026 100644 --- a/agent/src/util/device_plugin_service.rs +++ b/agent/src/util/device_plugin_service.rs @@ -83,7 +83,7 @@ pub struct DevicePluginService { pub config_uid: String, /// Namespace of Instance's Configuration CRD pub config_namespace: String, - /// Instance is [not]shared + /// Instance is \[not\]shared pub shared: bool, /// Hostname of node this Device Plugin is running on pub node_name: String, @@ -340,11 +340,11 @@ impl DevicePluginService { /// This returns the value that should be inserted at `device_usage_id` slot for an instance else an error. /// # More details /// Cases based on the usage slot (`device_usage_id`) value -/// 1. device_usage[id] == "" ... this means that the device is available for use +/// 1. device_usage\[id\] == "" ... this means that the device is available for use /// * return this node name -/// 2. device_usage[id] == self.nodeName ... this means THIS node previously used id, but the DevicePluginManager knows that this is no longer true +/// 2. device_usage\[id\] == self.nodeName ... this means THIS node previously used id, but the DevicePluginManager knows that this is no longer true /// * return "" -/// 3. device_usage[id] == ... this means that we believe this device is in use by another node and should be marked unhealthy +/// 3. device_usage\[id\] == ... this means that we believe this device is in use by another node and should be marked unhealthy /// * return error /// 4. No corresponding id found ... this is an unknown error condition (BAD) /// * return error @@ -893,10 +893,11 @@ mod device_plugin_service_tests { .map(|x| format!("{}-{}", instance_name, x)) .collect(); assert_eq!(devices.len(), capacity); - // Can't use map on Device type - let device_ids: Vec = devices.into_iter().map(|device| device.id).collect(); for device in expected_device_ids { - assert!(device_ids.contains(&device)); + assert!(devices + .iter() + .map(|device| device.id.clone()) + .any(|d| d == device)); } } diff --git a/agent/src/util/discovery_operator.rs b/agent/src/util/discovery_operator.rs index b997ad462..c05e0cbcf 100644 --- a/agent/src/util/discovery_operator.rs +++ b/agent/src/util/discovery_operator.rs @@ -871,7 +871,7 @@ pub mod tests { name: name.to_string(), endpoint, shared, - close_discovery_handler_connection: close_discovery_handler_connection, + close_discovery_handler_connection, } } diff --git a/agent/src/util/registration.rs b/agent/src/util/registration.rs index abe0e9340..522d04d05 100644 --- a/agent/src/util/registration.rs +++ b/agent/src/util/registration.rs @@ -186,7 +186,8 @@ pub async fn internal_run_registration_server( tokio::net::UnixListener::bind(socket_path).expect("Failed to bind to socket path"); async_stream::stream! { - while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + loop { + let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await; yield item; } } diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 537395171..70630ec83 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "controller" -version = "0.8.1" +version = "0.8.2" authors = ["", ""] edition = "2018" diff --git a/controller/src/util/instance_action.rs b/controller/src/util/instance_action.rs index 6b6b7937d..5891f601d 100644 --- a/controller/src/util/instance_action.rs +++ b/controller/src/util/instance_action.rs @@ -334,6 +334,7 @@ mod handle_deletion_work_tests { /// broker Pod, the broker Service, and the capability Service. /// TODO: reduce parameters by passing Instance object instead of /// individual fields +#[allow(clippy::too_many_arguments)] async fn handle_addition_work( instance_name: &str, instance_uid: &str, @@ -689,7 +690,7 @@ mod handle_instance_tests { "\"startTime\": \"2020-02-25T20:48:03Z\"", &format!( "\"startTime\": \"{}\"", - start_time.format("%Y-%m-%dT%H:%M:%SZ").to_string() + start_time.format("%Y-%m-%dT%H:%M:%SZ") ), ); let pods: PodList = serde_json::from_str(&start_time_adjusted_json).unwrap(); diff --git a/controller/src/util/node_watcher.rs b/controller/src/util/node_watcher.rs index 2f14ca816..78d3e775b 100644 --- a/controller/src/util/node_watcher.rs +++ b/controller/src/util/node_watcher.rs @@ -550,7 +550,7 @@ mod tests { "selfLink": "" } }"#; - fn listify_node(node_json: &String) -> String { + fn listify_node(node_json: &str) -> String { format!("{}\n{}\n{}", LIST_PREFIX, node_json, LIST_SUFFIX) } diff --git a/controller/src/util/pod_watcher.rs b/controller/src/util/pod_watcher.rs index 17bce39a7..d5d8683ff 100644 --- a/controller/src/util/pod_watcher.rs +++ b/controller/src/util/pod_watcher.rs @@ -523,6 +523,7 @@ impl BrokerPodWatcher { } /// This creates new service or updates existing service with ownership. + #[allow(clippy::too_many_arguments)] async fn create_or_update_service( &self, instance_name: &str, @@ -1584,7 +1585,11 @@ mod tests { #[derive(Clone)] struct CleanupServices { + // This field is used for testing + #[allow(dead_code)] find_svc_selector: &'static str, + // This field is used for testing + #[allow(dead_code)] find_svc_result: &'static str, cleanup_services: Vec, find_instance_id: &'static str, diff --git a/controller/src/util/shared_test_utils.rs b/controller/src/util/shared_test_utils.rs index b8425de09..a21b79e32 100644 --- a/controller/src/util/shared_test_utils.rs +++ b/controller/src/util/shared_test_utils.rs @@ -57,7 +57,7 @@ pub mod config_for_tests { "selfLink": "" } }"#; - fn listify_kube_object(node_json: &String) -> String { + fn listify_kube_object(node_json: &str) -> String { format!("{}\n{}\n{}", LIST_PREFIX, node_json, LIST_SUFFIX) } diff --git a/deployment/helm/Chart.yaml b/deployment/helm/Chart.yaml index 366daa47c..7f5b32ceb 100644 --- a/deployment/helm/Chart.yaml +++ b/deployment/helm/Chart.yaml @@ -15,9 +15,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.8.1 +version: 0.8.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 0.8.1 +appVersion: 0.8.2 diff --git a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml index f4723fbbd..e606e4d4f 100644 --- a/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/debug-echo-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "debug-echo-discovery-handler" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml index 93b632b0d..d5629c30a 100644 --- a/discovery-handler-modules/onvif-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/onvif-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "onvif-discovery-handler" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml index b30d64f55..ed29a8b54 100644 --- a/discovery-handler-modules/opcua-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/opcua-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opcua-discovery-handler" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handler-modules/udev-discovery-handler/Cargo.toml b/discovery-handler-modules/udev-discovery-handler/Cargo.toml index f79219c45..5672e5047 100644 --- a/discovery-handler-modules/udev-discovery-handler/Cargo.toml +++ b/discovery-handler-modules/udev-discovery-handler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-discovery-handler" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/debug-echo/Cargo.toml b/discovery-handlers/debug-echo/Cargo.toml index 0f21bcbad..fe18b1ca5 100644 --- a/discovery-handlers/debug-echo/Cargo.toml +++ b/discovery-handlers/debug-echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-debug-echo" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/onvif/Cargo.toml b/discovery-handlers/onvif/Cargo.toml index 54be12c79..656ce892a 100644 --- a/discovery-handlers/onvif/Cargo.toml +++ b/discovery-handlers/onvif/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-onvif" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/onvif/src/discovery_handler.rs b/discovery-handlers/onvif/src/discovery_handler.rs index 3d19c8e8b..2a92356f5 100644 --- a/discovery-handlers/onvif/src/discovery_handler.rs +++ b/discovery-handlers/onvif/src/discovery_handler.rs @@ -108,7 +108,7 @@ impl DiscoveryHandler for DiscoveryHandlerImpl { let futures: Vec<_> = latest_cameras .iter() .filter(|c| !previous_cameras.contains(c)) - .map(|c| apply_filters(&discovery_handler_config, &c, &onvif_query)) + .map(|c| apply_filters(&discovery_handler_config, c, &onvif_query)) .collect(); let options = futures_util::future::join_all(futures).await; // Insert newly discovered camera that are not filtered out @@ -154,7 +154,7 @@ async fn apply_filters( ) -> Option<(String, Device)> { info!("apply_filters - device service url {}", device_service_uri); let (ip_address, mac_address) = match onvif_query - .get_device_ip_and_mac_address(&device_service_uri) + .get_device_ip_and_mac_address(device_service_uri) .await { Ok(ip_and_mac) => ip_and_mac, diff --git a/discovery-handlers/onvif/src/discovery_impl.rs b/discovery-handlers/onvif/src/discovery_impl.rs index 10fd0d976..0454a3382 100644 --- a/discovery-handlers/onvif/src/discovery_impl.rs +++ b/discovery-handlers/onvif/src/discovery_impl.rs @@ -304,7 +304,7 @@ pub mod util { let envelope_as_string = create_onvif_discovery_message(&uuid_str); socket - .send_to(&envelope_as_string.as_bytes(), multi_socket_addr) + .send_to(envelope_as_string.as_bytes(), multi_socket_addr) .await?; Ok(socket) } diff --git a/discovery-handlers/onvif/src/discovery_utils.rs b/discovery-handlers/onvif/src/discovery_utils.rs index 184f87a13..75dabe0f8 100644 --- a/discovery-handlers/onvif/src/discovery_utils.rs +++ b/discovery-handlers/onvif/src/discovery_utils.rs @@ -364,7 +364,7 @@ async fn inner_get_device_profile_streaming_uri( /// Gets the streaming uri for a given profile for an ONVIF camera async fn inner_is_device_responding(url: &str, http: &impl Http) -> Result { http.post( - &url, + url, &get_action(DEVICE_WSDL, "GetSystemDateAndTime"), &GET_SYSTEM_DATE_AND_TIME_TEMPLATE.to_string(), ) diff --git a/discovery-handlers/opcua/Cargo.toml b/discovery-handlers/opcua/Cargo.toml index 46b68b985..799671a39 100644 --- a/discovery-handlers/opcua/Cargo.toml +++ b/discovery-handlers/opcua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-opcua" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/udev/Cargo.toml b/discovery-handlers/udev/Cargo.toml index 8961ae2aa..272e73553 100644 --- a/discovery-handlers/udev/Cargo.toml +++ b/discovery-handlers/udev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-udev" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-handlers/udev/src/discovery_impl.rs b/discovery-handlers/udev/src/discovery_impl.rs index a1f3ce117..618780dfa 100644 --- a/discovery-handlers/udev/src/discovery_impl.rs +++ b/discovery-handlers/udev/src/discovery_impl.rs @@ -603,6 +603,7 @@ mod discovery_tests { } } + #[allow(clippy::too_many_arguments)] fn create_mock_device<'a>( devpath: &str, devnode: &str, diff --git a/discovery-utils/Cargo.toml b/discovery-utils/Cargo.toml index 10993c4e4..02b8cbfd1 100644 --- a/discovery-utils/Cargo.toml +++ b/discovery-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-discovery-utils" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring "] edition = "2018" diff --git a/discovery-utils/src/discovery/mod.rs b/discovery-utils/src/discovery/mod.rs index 25dbbbe79..92744d8b7 100644 --- a/discovery-utils/src/discovery/mod.rs +++ b/discovery-utils/src/discovery/mod.rs @@ -228,7 +228,8 @@ pub mod server { let uds = UnixListener::bind(discovery_endpoint)?; async_stream::stream! { - while let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await { + loop { + let item = uds.accept().map_ok(|(st, _)| unix_stream::UnixStream(st)).await; yield item; } } diff --git a/discovery-utils/src/filtering.rs b/discovery-utils/src/filtering.rs index 7c98f3de1..0b4586c17 100644 --- a/discovery-utils/src/filtering.rs +++ b/discovery-utils/src/filtering.rs @@ -57,9 +57,9 @@ mod tests { items: exclude_items, action: FilterType::Exclude, }); - assert_eq!(should_include(exclude_filter_list.as_ref(), "beep"), false); - assert_eq!(should_include(exclude_filter_list.as_ref(), "bop"), false); - assert_eq!(should_include(exclude_filter_list.as_ref(), "boop"), true); + assert!(!should_include(exclude_filter_list.as_ref(), "beep")); + assert!(!should_include(exclude_filter_list.as_ref(), "bop")); + assert!(should_include(exclude_filter_list.as_ref(), "boop")); // Test when FilterType::Exclude and FilterList.items is empty let empty_exclude_items = Vec::new(); @@ -67,10 +67,7 @@ mod tests { items: empty_exclude_items, action: FilterType::Exclude, }); - assert_eq!( - should_include(empty_exclude_filter_list.as_ref(), "beep"), - true - ); + assert!(should_include(empty_exclude_filter_list.as_ref(), "beep")); // Test when FilterType::Include let include_items = vec!["beep".to_string(), "bop".to_string()]; @@ -78,9 +75,9 @@ mod tests { items: include_items, action: FilterType::Include, }); - assert_eq!(should_include(include_filter_list.as_ref(), "beep"), true); - assert_eq!(should_include(include_filter_list.as_ref(), "bop"), true); - assert_eq!(should_include(include_filter_list.as_ref(), "boop"), false); + assert!(should_include(include_filter_list.as_ref(), "beep")); + assert!(should_include(include_filter_list.as_ref(), "bop")); + assert!(!should_include(include_filter_list.as_ref(), "boop")); // Test when FilterType::Include and FilterList.items is empty let empty_include_items = Vec::new(); @@ -88,12 +85,9 @@ mod tests { items: empty_include_items, action: FilterType::Include, }); - assert_eq!( - should_include(empty_include_filter_list.as_ref(), "beep"), - false - ); + assert!(!should_include(empty_include_filter_list.as_ref(), "beep")); // Test when None - assert_eq!(should_include(None, "beep"), true); + assert!(should_include(None, "beep")); } } diff --git a/samples/brokers/udev-video-broker/Cargo.toml b/samples/brokers/udev-video-broker/Cargo.toml index 264f81f76..015266428 100644 --- a/samples/brokers/udev-video-broker/Cargo.toml +++ b/samples/brokers/udev-video-broker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "udev-video-broker" -version = "0.8.1" +version = "0.8.2" authors = ["Kate Goldenring ", ""] edition = "2018" diff --git a/shared/Cargo.toml b/shared/Cargo.toml index a225fa2bf..24c34cd90 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "akri-shared" -version = "0.8.1" +version = "0.8.2" authors = [""] edition = "2018" diff --git a/shared/src/akri/configuration.rs b/shared/src/akri/configuration.rs index 24c7319eb..de5ae9cd9 100644 --- a/shared/src/akri/configuration.rs +++ b/shared/src/akri/configuration.rs @@ -33,7 +33,7 @@ pub struct DiscoveryHandlerInfo { /// that can access a capability described by this Configuration. /// The enum contents are boxed to use the heap instead of the stack. /// See this clippy warning for more details: -/// https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant +/// #[derive(Serialize, Deserialize, PartialEq, Clone, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] pub enum BrokerSpec { diff --git a/shared/src/akri/instance.rs b/shared/src/akri/instance.rs index 3e7caefd1..0253c32c6 100644 --- a/shared/src/akri/instance.rs +++ b/shared/src/akri/instance.rs @@ -383,7 +383,7 @@ mod crd_serializeation_tests { let deserialized: InstanceSpec = serde_json::from_str(json).unwrap(); assert_eq!("blah".to_string(), deserialized.configuration_name); assert_eq!(1, deserialized.broker_properties.len()); - assert_eq!(true, deserialized.shared); + assert!(deserialized.shared); assert_eq!(2, deserialized.nodes.len()); assert_eq!(2, deserialized.device_usage.len()); diff --git a/shared/src/k8s/mod.rs b/shared/src/k8s/mod.rs index d693461de..757abe0b6 100644 --- a/shared/src/k8s/mod.rs +++ b/shared/src/k8s/mod.rs @@ -701,8 +701,8 @@ pub mod test_ownership { ownership.get_api_version() ); assert_eq!("Configuration", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller().unwrap()); - assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); + assert!(ownership.get_controller().unwrap()); + assert!(ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -717,8 +717,8 @@ pub mod test_ownership { ownership.get_api_version() ); assert_eq!("Instance", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller().unwrap()); - assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); + assert!(ownership.get_controller().unwrap()); + assert!(ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -729,8 +729,8 @@ pub mod test_ownership { let ownership = OwnershipInfo::new(OwnershipType::Pod, name.to_string(), uid.to_string()); assert_eq!("core/v1", ownership.get_api_version()); assert_eq!("Pod", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller().unwrap()); - assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); + assert!(ownership.get_controller().unwrap()); + assert!(ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } @@ -742,8 +742,8 @@ pub mod test_ownership { OwnershipInfo::new(OwnershipType::Service, name.to_string(), uid.to_string()); assert_eq!("core/v1", ownership.get_api_version()); assert_eq!("Service", &ownership.get_kind()); - assert_eq!(true, ownership.get_controller().unwrap()); - assert_eq!(true, ownership.get_block_owner_deletion().unwrap()); + assert!(ownership.get_controller().unwrap()); + assert!(ownership.get_block_owner_deletion().unwrap()); assert_eq!(name, &ownership.get_name()); assert_eq!(uid, &ownership.get_uid()); } diff --git a/shared/src/k8s/pod.rs b/shared/src/k8s/pod.rs index a6f6a9a61..b0df65ed9 100644 --- a/shared/src/k8s/pod.rs +++ b/shared/src/k8s/pod.rs @@ -146,6 +146,7 @@ type ResourceQuantityType = BTreeMap; /// &PodSpec::default()).unwrap(); /// # } /// ``` +#[allow(clippy::too_many_arguments)] pub fn create_new_pod_from_spec( pod_namespace: &str, instance_name: &str, diff --git a/version.txt b/version.txt index 6f4eebdf6..100435be1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.8.1 +0.8.2 diff --git a/webhooks/validating/configuration/Cargo.toml b/webhooks/validating/configuration/Cargo.toml index a4b1f1e8d..6b79932d7 100644 --- a/webhooks/validating/configuration/Cargo.toml +++ b/webhooks/validating/configuration/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webhook-configuration" -version = "0.8.1" +version = "0.8.2" authors = ["DazWilkin "] edition = "2018" diff --git a/webhooks/validating/configuration/src/main.rs b/webhooks/validating/configuration/src/main.rs index e6ba1370a..d578d0821 100644 --- a/webhooks/validating/configuration/src/main.rs +++ b/webhooks/validating/configuration/src/main.rs @@ -386,7 +386,7 @@ mod tests { "targetPort": 0, "protocol": "TCP" }] - }, + }, "capacity": 1 } }, @@ -733,7 +733,7 @@ mod tests { .expect("v1.AdmissionReview JSON"); let rqst = valid.request.expect("v1.AdmissionRequest JSON"); let resp = validate_configuration(&rqst); - assert_eq!(resp.allowed, true); + assert!(resp.allowed); } #[test] @@ -743,7 +743,7 @@ mod tests { .expect("v1.AdmissionReview JSON"); let rqst = valid.request.expect("v1.AdmissionRequest JSON"); let resp = validate_configuration(&rqst); - assert_eq!(resp.allowed, true); + assert!(resp.allowed); } #[test] @@ -753,7 +753,7 @@ mod tests { .expect("v1.AdmissionReview JSON"); let rqst = invalid.request.expect("v1.AdmissionRequest JSON"); let resp = validate_configuration(&rqst); - assert_eq!(resp.allowed, false); + assert!(!resp.allowed); } #[test] @@ -763,7 +763,7 @@ mod tests { .expect("v1.AdmissionReview JSON"); let rqst = invalid.request.expect("v1.AdmissionRequest JSON"); let resp = validate_configuration(&rqst); - assert_eq!(resp.allowed, false); + assert!(!resp.allowed); } #[test] @@ -783,7 +783,7 @@ mod tests { .expect("v1.AdmissionReview JSON"); let rqst = valid.request.expect("v1.AdmissionRequest JSON"); let resp = validate_configuration(&rqst); - assert_eq!(resp.allowed, true); + assert!(resp.allowed); } #[actix_rt::test] @@ -797,7 +797,7 @@ mod tests { .set_json(&valid) .to_request(); let resp = test::call_service(&mut app, rqst).await; - assert_eq!(resp.status().is_success(), true); + assert!(resp.status().is_success()); } #[actix_rt::test] @@ -811,7 +811,7 @@ mod tests { .set_json(&valid) .to_request(); let resp = test::call_service(&mut app, rqst).await; - assert_eq!(resp.status().is_success(), true); + assert!(resp.status().is_success()); } #[actix_rt::test] @@ -825,7 +825,7 @@ mod tests { .set_json(&invalid) .to_request(); let resp = test::call_service(&mut app, rqst).await; - assert_eq!(resp.status().is_success(), true); + assert!(resp.status().is_success()); } #[actix_rt::test] @@ -839,6 +839,6 @@ mod tests { .set_json(&invalid) .to_request(); let resp = test::call_service(&mut app, rqst).await; - assert_eq!(resp.status().is_success(), true); + assert!(resp.status().is_success()); } }