feat: removed more unneccesary clones

This commit is contained in:
Bram Dingelstad 2025-02-21 16:46:57 +01:00
parent 50ccd6b339
commit 1ff6ebc113

View file

@ -388,9 +388,7 @@ pub struct Users<'a> {
impl Users<'_> { impl Users<'_> {
pub async fn get(&self) -> Result<QueryResponse<User>> { pub async fn get(&self) -> Result<QueryResponse<User>> {
let url = "https://api.notion.com/v1/users".to_owned(); let request = self.http_client.get("https://api.notion.com/v1/users");
let request = self.http_client.get(&url);
let mut response = (self.request_handler)(request).await?; let mut response = (self.request_handler)(request).await?;
@ -841,7 +839,7 @@ pub enum DatabaseProperty {
} }
impl DatabaseProperty { impl DatabaseProperty {
pub fn id(&self) -> Option<String> { pub fn id(&self) -> Option<&str> {
use DatabaseProperty::*; use DatabaseProperty::*;
match self { match self {
@ -864,13 +862,13 @@ impl DatabaseProperty {
| Status { id, .. } | Status { id, .. }
| Title { id, .. } | Title { id, .. }
| Button { id, .. } | Button { id, .. }
| Url { id, .. } => Some(id.to_owned()), | Url { id, .. } => Some(id),
Unsupported(..) => None, Unsupported(..) => None,
} }
} }
pub fn name(&self) -> Option<String> { pub fn name(&self) -> Option<&str> {
use DatabaseProperty::*; use DatabaseProperty::*;
match self { match self {
@ -893,7 +891,7 @@ impl DatabaseProperty {
| Status { name, .. } | Status { name, .. }
| Button { name, .. } | Button { name, .. }
| Title { name, .. } | Title { name, .. }
| Url { name, .. } => Some(name.to_owned()), | Url { name, .. } => Some(name),
Unsupported(..) => None, Unsupported(..) => None,
} }
@ -1082,7 +1080,7 @@ pub enum Property {
} }
impl Property { impl Property {
pub fn id(&self) -> Option<String> { pub fn id(&self) -> Option<&str> {
use Property::*; use Property::*;
match self { match self {
@ -1108,7 +1106,7 @@ impl Property {
| Formula { id, .. } | Formula { id, .. }
| Verification { id, .. } | Verification { id, .. }
| Button { id, .. } | Button { id, .. }
| UniqueId { id, .. } => Some(id.to_owned()), | UniqueId { id, .. } => Some(id),
Unsupported(_) => None, Unsupported(_) => None,
} }