Skip to content

Commit 6aee425

Browse files
committed
Clippy: Display for Actions
1 parent 5bcf323 commit 6aee425

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

typesense/src/client/keys.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! More info [here](https://typesense.org/docs/0.20.0/api/api-keys.html).
44
55
use base64::{engine::general_purpose::STANDARD as Base64Engine, Engine};
6+
use core::fmt;
67
use hmac::{Hmac, Mac};
78
use serde::{Deserialize, Serialize};
89
use sha2::Sha256;
@@ -139,16 +140,16 @@ pub enum Actions {
139140
#[serde(rename = "*")]
140141
All,
141142
}
142-
impl ToString for Actions {
143-
fn to_string(&self) -> String {
143+
impl fmt::Display for Actions {
144+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
144145
match self {
145-
Self::DocumentsAll => "documents:*".to_string(),
146-
Self::DocumentsSearch => "documents:search".to_string(),
147-
Self::DocumentsGet => "documents:get".to_string(),
148-
Self::CollectionsAll => "collections:*".to_string(),
149-
Self::CollectionsDelete => "collections:delete".to_string(),
150-
Self::CollectionsCreate => "collections:create".to_string(),
151-
Self::All => "*".to_string(),
146+
Self::DocumentsAll => write!(f, "documents:*"),
147+
Self::DocumentsSearch => write!(f, "documents:search"),
148+
Self::DocumentsGet => write!(f, "documents:get"),
149+
Self::CollectionsAll => write!(f, "collections:*"),
150+
Self::CollectionsDelete => write!(f, "collections:delete"),
151+
Self::CollectionsCreate => write!(f, "collections:create"),
152+
Self::All => write!(f, "*"),
152153
}
153154
}
154155
}

0 commit comments

Comments
 (0)