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

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

floss: Construct DisplayAddress by borrowing

Avoid unnecessary copy when printing the addresses.

Bug: 269052788
Tag: #floss
Test: ./build.py --target test
Change-Id: I1828cbf8f0c8812da5867a8bc3654f84dec723e4
parent 58a9ebba
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1934,7 +1934,7 @@ impl IBluetooth for Bluetooth {
        // If SDP isn't completed yet, we wait for it to complete and retry the connection again.
        // Otherwise, this connection request is done, no retry is required.
        if !has_enabled_uuids {
            warn!("[{}] SDP hasn't completed for device, wait to connect.", DisplayAddress(addr));
            warn!("[{}] SDP hasn't completed for device, wait to connect.", DisplayAddress(&addr));
            if let Some(d) = self.get_remote_device_if_found_mut(&device.address) {
                if uuids.len() == 0 || !d.services_resolved {
                    d.wait_to_connect = true;
+53 −53

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -819,8 +819,8 @@ impl RawAddress {
}

/// Address that is safe to display in logs.
pub struct DisplayAddress(pub RawAddress);
impl Display for DisplayAddress {
pub struct DisplayAddress<'a>(pub &'a RawAddress);
impl<'a> Display for DisplayAddress<'a> {
    fn fmt(&self, f: &mut Formatter) -> Result {
        write!(f, "xx:xx:xx:xx:{:2X}:{:2X}", &self.0.address[4], &self.0.address[5])
    }