Skip to content

Commit ddda695

Browse files
Fix clippy warnings
1 parent 900f0d2 commit ddda695

8 files changed

Lines changed: 19 additions & 27 deletions

File tree

client/src/file/api/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ impl Keyring {
260260
if let Some(mut path) = data_dir() {
261261
path.push("keyrings");
262262
if version > 0 {
263-
path.push(format!("v{}", version));
263+
path.push(format!("v{version}"));
264264
}
265-
path.push(format!("{}.keyring", name));
265+
path.push(format!("{name}.keyring"));
266266
Ok(path)
267267
} else {
268268
Err(Error::NoDataDir)

client/src/secret.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl FromStr for ContentType {
3737
match s {
3838
"text/plain" => Ok(Self::Text),
3939
"application/octet-stream" => Ok(Self::Blob),
40-
e => Err(format!("Invalid content type: {}", e)),
40+
e => Err(format!("Invalid content type: {e}")),
4141
}
4242
}
4343
}

server/src/capability.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ pub enum Error {
1313
impl std::fmt::Display for Error {
1414
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1515
match self {
16-
Self::CapsRead(e) => write!(f, "Failed to read process capabilities: {}", e),
17-
Self::CapsUpdate(e) => write!(f, "Failed updating process capabilities: {}", e),
18-
Self::DropGroups(e) => write!(f, "Failed to drop supplementary groups: {}", e),
19-
Self::SetGid(e) => write!(f, "Failed to setgid: {}", e),
20-
Self::SetUid(e) => write!(f, "Failed to setuid: {}", e),
16+
Self::CapsRead(e) => write!(f, "Failed to read process capabilities: {e}"),
17+
Self::CapsUpdate(e) => write!(f, "Failed updating process capabilities: {e}"),
18+
Self::DropGroups(e) => write!(f, "Failed to drop supplementary groups: {e}"),
19+
Self::SetGid(e) => write!(f, "Failed to setgid: {e}"),
20+
Self::SetUid(e) => write!(f, "Failed to setuid: {e}"),
2121
}
2222
}
2323
}

server/src/collection.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ impl Collection {
9393
let Some(session) = self.service.session(&session).await else {
9494
tracing::error!("The session `{}` does not exist.", session);
9595
return Err(ServiceError::NoSession(format!(
96-
"The session `{}` does not exist.",
97-
session
96+
"The session `{session}` does not exist."
9897
)));
9998
};
10099

@@ -201,8 +200,7 @@ impl Collection {
201200
alias: Arc::new(Mutex::new(alias.to_owned())),
202201
item_index: Arc::new(RwLock::new(0)),
203202
path: OwnedObjectPath::try_from(format!(
204-
"/org/freedesktop/secrets/collection/{}",
205-
label
203+
"/org/freedesktop/secrets/collection/{label}"
206204
))
207205
.unwrap(),
208206
created,
@@ -312,15 +310,13 @@ impl Collection {
312310
pub async fn delete_item(&self, path: &OwnedObjectPath) -> Result<(), ServiceError> {
313311
let Some(item) = self.item_from_path(path).await else {
314312
return Err(ServiceError::NoSuchObject(format!(
315-
"Item `{}` does not exist.",
316-
path
313+
"Item `{path}` does not exist."
317314
)));
318315
};
319316

320317
if item.is_locked().await {
321318
return Err(ServiceError::IsLocked(format!(
322-
"Cannot delete a locked item `{}`",
323-
path
319+
"Cannot delete a locked item `{path}`"
324320
)));
325321
}
326322

server/src/gnome/prompter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Properties {
4848
Self {
4949
title: None,
5050
message: Some("Lock Keyring".to_owned()),
51-
description: Some(format!("Confirm locking '{}' Keyring", keyring)),
51+
description: Some(format!("Confirm locking '{keyring}' Keyring")),
5252
warning: None,
5353
password_new: None,
5454
password_strength: None,
@@ -69,8 +69,7 @@ impl Properties {
6969
title: Some("Unlock Keyring".to_owned()),
7070
message: Some("Authentication required".to_owned()),
7171
description: Some(format!(
72-
"An application wants access to the keyring '{}', but it is locked",
73-
keyring
72+
"An application wants access to the keyring '{keyring}', but it is locked"
7473
)),
7574
warning: warning.map(ToOwned::to_owned),
7675
password_new: None,

server/src/gnome/secret_exchange.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ iv=8e3N+gx553PgQlfTKRK3JA==";
135135
let peer_1_aes_key = handshake(&peer_1_private_key, &peer_2_exchange).unwrap();
136136
let peer_2_aes_key = handshake(&peer_2_private_key, &peer_1_exchange).unwrap();
137137
let iv = crypto::generate_iv().unwrap();
138-
let encrypted = crypto::encrypt(b"password".to_vec(), &peer_1_aes_key, &iv).unwrap();
138+
let encrypted = crypto::encrypt(b"password", &peer_1_aes_key, &iv).unwrap();
139139

140140
let map = HashMap::from([
141141
(PUBLIC, peer_1_public_key.as_ref()),

server/src/item.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ impl Item {
6262
let Some(session) = self.service.session(&session).await else {
6363
tracing::error!("The session `{}` does not exist.", session);
6464
return Err(ServiceError::NoSession(format!(
65-
"The session `{}` does not exist.",
66-
session
65+
"The session `{session}` does not exist."
6766
)));
6867
};
6968

@@ -112,8 +111,7 @@ impl Item {
112111
let Some(session) = self.service.session(&session).await else {
113112
tracing::error!("The session `{}` does not exist.", session);
114113
return Err(ServiceError::NoSession(format!(
115-
"The session `{}` does not exist.",
116-
session
114+
"The session `{session}` does not exist."
117115
)));
118116
};
119117

@@ -188,7 +186,7 @@ impl Item {
188186
locked: Arc::new(AtomicBool::new(locked)),
189187
inner: Arc::new(Mutex::new(item)),
190188
collection_path: collection_path.clone(),
191-
path: OwnedObjectPath::try_from(format!("{}/{}", collection_path, item_index)).unwrap(),
189+
path: OwnedObjectPath::try_from(format!("{collection_path}/{item_index}")).unwrap(),
192190
service,
193191
}
194192
}

server/src/service.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ impl Service {
255255
tracing::info!("Collection: {} does not exist.", collection);
256256

257257
Err(ServiceError::NoSuchObject(format!(
258-
"The collection: {} does not exist.",
259-
collection,
258+
"The collection: {collection} does not exist.",
260259
)))
261260
}
262261

0 commit comments

Comments
 (0)