From 1ff6ebc113c16e86a924d1f99d3b3e491ae41b94 Mon Sep 17 00:00:00 2001 From: Bram Dingelstad <git@dingelstad.works> Date: Fri, 21 Feb 2025 16:46:57 +0100 Subject: [PATCH] feat: removed more unneccesary clones --- src/lib.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e25c09d..44f8aa0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -388,9 +388,7 @@ pub struct Users<'a> { impl Users<'_> { pub async fn get(&self) -> Result<QueryResponse<User>> { - let url = "https://api.notion.com/v1/users".to_owned(); - - let request = self.http_client.get(&url); + let request = self.http_client.get("https://api.notion.com/v1/users"); let mut response = (self.request_handler)(request).await?; @@ -841,7 +839,7 @@ pub enum DatabaseProperty { } impl DatabaseProperty { - pub fn id(&self) -> Option<String> { + pub fn id(&self) -> Option<&str> { use DatabaseProperty::*; match self { @@ -864,13 +862,13 @@ impl DatabaseProperty { | Status { id, .. } | Title { id, .. } | Button { id, .. } - | Url { id, .. } => Some(id.to_owned()), + | Url { id, .. } => Some(id), Unsupported(..) => None, } } - pub fn name(&self) -> Option<String> { + pub fn name(&self) -> Option<&str> { use DatabaseProperty::*; match self { @@ -893,7 +891,7 @@ impl DatabaseProperty { | Status { name, .. } | Button { name, .. } | Title { name, .. } - | Url { name, .. } => Some(name.to_owned()), + | Url { name, .. } => Some(name), Unsupported(..) => None, } @@ -1082,7 +1080,7 @@ pub enum Property { } impl Property { - pub fn id(&self) -> Option<String> { + pub fn id(&self) -> Option<&str> { use Property::*; match self { @@ -1108,7 +1106,7 @@ impl Property { | Formula { id, .. } | Verification { id, .. } | Button { id, .. } - | UniqueId { id, .. } => Some(id.to_owned()), + | UniqueId { id, .. } => Some(id), Unsupported(_) => None, }