From 6d89a9ed9366977ff73b531f4ce21f37a94c36ad Mon Sep 17 00:00:00 2001 From: SHAcollision Date: Wed, 28 Aug 2024 08:44:00 +0200 Subject: [PATCH] Fix clippy --- src/models/homeserver/bookmark.rs | 4 ++-- src/models/homeserver/tag.rs | 9 ++++----- src/models/homeserver/traits.rs | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/models/homeserver/bookmark.rs b/src/models/homeserver/bookmark.rs index 495b59c9..4c98ad21 100644 --- a/src/models/homeserver/bookmark.rs +++ b/src/models/homeserver/bookmark.rs @@ -16,7 +16,7 @@ pub struct HomeserverBookmark { } impl GenerateId for HomeserverBookmark { - fn get_id_data(&self) -> String { + fn _get_id_data(&self) -> String { self.uri.clone() } } @@ -28,6 +28,6 @@ fn test_create_bookmark_id() { created_at: 1627849723, }; - let bookmark_id = bookmark.create_id(); + let bookmark_id = bookmark._create_id(); println!("Generated Bookmark ID: {}", bookmark_id); } diff --git a/src/models/homeserver/tag.rs b/src/models/homeserver/tag.rs index 3b35c7d5..5de95405 100644 --- a/src/models/homeserver/tag.rs +++ b/src/models/homeserver/tag.rs @@ -20,7 +20,7 @@ pub struct HomeserverTag { } impl GenerateId for HomeserverTag { - fn get_id_data(&self) -> String { + fn _get_id_data(&self) -> String { format!("{}:{}", self.uri, self.label) } } @@ -38,7 +38,7 @@ impl HomeserverTag { /// /// # Returns /// - A `String` representing the Base32-encoded tag ID derived from the `blake3` hash of the concatenated `uri` and `label`. - pub fn create_id(&self) -> String { + pub fn _create_id(&self) -> String { // Concatenate the URI and label with a colon in between let data = format!("{}:{}", self.uri, self.label); @@ -52,10 +52,9 @@ impl HomeserverTag { let half_hash = &blake3_hash.as_bytes()[..half_hash_length]; // Encode the first half of the hash in Base32 using the Z-base32 alphabet - let base32_encoded = encode(Alphabet::Z, half_hash); // Return the Base32 encoded string as the tag ID - base32_encoded + encode(Alphabet::Z, half_hash) } } @@ -67,6 +66,6 @@ fn test_create_id() { label: "cool".to_string(), }; - let tag_id = tag.create_id(); + let tag_id = tag._create_id(); println!("Generated Tag ID: {}", tag_id); } diff --git a/src/models/homeserver/traits.rs b/src/models/homeserver/traits.rs index 3db24544..812c5824 100644 --- a/src/models/homeserver/traits.rs +++ b/src/models/homeserver/traits.rs @@ -3,7 +3,7 @@ use blake3::Hasher; /// Trait for generating an ID based on the struct's data. pub trait GenerateId { - fn get_id_data(&self) -> String; + fn _get_id_data(&self) -> String; /// Creates a unique identifier for bookmarks and tag homeserver paths instance. /// @@ -17,8 +17,8 @@ pub trait GenerateId { /// /// # Returns /// - A `String` representing the Base32-encoded tag ID derived from the `blake3` hash of the concatenated `uri` and `label`. - fn create_id(&self) -> String { - let data = self.get_id_data(); + fn _create_id(&self) -> String { + let data = self._get_id_data(); // Create a Blake3 hash of the input data let mut hasher = Hasher::new();