Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efe7e97c authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

floss service: Fix clippy warnings

- warning: this `MutexGuard` is held across an `await` point
- warning: this function has too many arguments (17/7)
- warning: you seem to be trying to use `match` for destructuring a
           single pattern. Consider using `if let`
- warning: this import is redundant

Bug: 343315863
Tag: #floss
Test: mmm packages/modules/Bluetooth
Test: ./build.py --target test
Flag: EXEMPT, Floss-only changes
Change-Id: I55366cf160c3d9f6335756c6d8f1cc1a6b1ae793
parent 7d8e58e9
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -446,15 +446,12 @@ impl DBusArg for ScanFilterCondition {
        condition: ScanFilterCondition,
    ) -> Result<dbus::arg::PropMap, Box<dyn std::error::Error>> {
        let mut map: dbus::arg::PropMap = std::collections::HashMap::new();
        match condition {
            ScanFilterCondition::Patterns(patterns) => {
        if let ScanFilterCondition::Patterns(patterns) = condition {
            map.insert(
                String::from("patterns"),
                dbus::arg::Variant(Box::new(DBusArg::to_dbus(patterns)?)),
            );
        }
            _ => {}
        }
        Ok(map)
    }

+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ impl InterfaceManager {
    /// * `disconnect_watcher` - DisconnectWatcher to monitor client disconnects
    /// * `bluetooth` - Implementation of the Bluetooth API
    /// other implementations follow.
    ///
    #[allow(clippy::too_many_arguments)]
    pub async fn dispatch(
        mut rx: Receiver<APIMessage>,
        tx: Sender<Message>,
+4 −3
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use std::time::Duration;
use tokio::sync::mpsc::Sender;

// Necessary to link right entries.
#[allow(unused_imports)]
#[allow(clippy::single_component_path_imports, unused_imports)]
use bt_shim;

use bt_topshim::{btif::get_btinterface, topstack};
@@ -215,8 +215,9 @@ fn main() -> Result<(), Box<dyn Error>> {
        ));

        // Set up the disconnect watcher to monitor client disconnects.
        let disconnect_watcher = Arc::new(Mutex::new(DisconnectWatcher::new()));
        disconnect_watcher.lock().unwrap().setup_watch(conn.clone()).await;
        let mut disconnect_watcher = DisconnectWatcher::new();
        disconnect_watcher.setup_watch(conn.clone()).await;
        let disconnect_watcher = Arc::new(Mutex::new(disconnect_watcher));

        tokio::spawn(interface_manager::InterfaceManager::dispatch(
            api_rx,