From c20d52e2af1cd652be9d55232340aa42806e679a Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 17 Jun 2020 12:15:38 +0200 Subject: [PATCH] identifiers: Update `DeviceKeyId::device_id` to return a reference instead of cloning --- ruma-identifiers/src/device_key_id.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruma-identifiers/src/device_key_id.rs b/ruma-identifiers/src/device_key_id.rs index f13891cd..ce6ee730 100644 --- a/ruma-identifiers/src/device_key_id.rs +++ b/ruma-identifiers/src/device_key_id.rs @@ -1,6 +1,6 @@ //! Identifiers for device keys for end-to-end encryption. -use crate::{device_id::DeviceId, error::Error, key_algorithms::DeviceKeyAlgorithm}; +use crate::{error::Error, key_algorithms::DeviceKeyAlgorithm, DeviceIdRef}; use std::{num::NonZeroU8, str::FromStr}; /// A key algorithm and a device id, combined with a ':' @@ -21,11 +21,11 @@ impl DeviceKeyId { } /// Returns device ID of the device key ID. - pub fn device_id(&self) -> DeviceId + pub fn device_id(&self) -> DeviceIdRef<'_> where T: AsRef, { - DeviceId::from(&self.full_id.as_ref()[self.colon_idx.get() as usize + 1..]) + &self.full_id.as_ref()[self.colon_idx.get() as usize + 1..] } }