summaryrefslogtreecommitdiff
path: root/runtime/permissions/lib.rs
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-06-14 17:10:57 +0530
committerGitHub <noreply@github.com>2024-06-14 17:10:57 +0530
commit0f48313565ed2620efbd9d0f2203b57f8f126e6a (patch)
tree39e348917188b7524eadc138dfcf80f92a185ac6 /runtime/permissions/lib.rs
parente19ee6eecc416a99801231ac53f2c512ba1f81dd (diff)
chore: upgrade to rust 1.79 (#24207)
Diffstat (limited to 'runtime/permissions/lib.rs')
-rw-r--r--runtime/permissions/lib.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/runtime/permissions/lib.rs b/runtime/permissions/lib.rs
index 2e94e3aec..4579eba1a 100644
--- a/runtime/permissions/lib.rs
+++ b/runtime/permissions/lib.rs
@@ -592,7 +592,7 @@ impl<T: Descriptor + Hash> UnaryPermission<T> {
match flag {
ChildUnaryPermissionArg::Inherit => {
- perms = self.clone();
+ perms.clone_from(self);
}
ChildUnaryPermissionArg::Granted => {
if self.check_all_api(None).is_err() {
@@ -615,10 +615,12 @@ impl<T: Descriptor + Hash> UnaryPermission<T> {
}
}
perms.flag_denied_global = self.flag_denied_global;
- perms.flag_denied_list = self.flag_denied_list.clone();
perms.prompt_denied_global = self.prompt_denied_global;
- perms.prompt_denied_list = self.prompt_denied_list.clone();
perms.prompt = self.prompt;
+ perms.flag_denied_list.clone_from(&self.flag_denied_list);
+ perms
+ .prompt_denied_list
+ .clone_from(&self.prompt_denied_list);
Ok(perms)
}
@@ -864,11 +866,11 @@ impl From<PathBuf> for RunDescriptor {
}
}
-impl ToString for RunDescriptor {
- fn to_string(&self) -> String {
+impl std::fmt::Display for RunDescriptor {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- RunDescriptor::Name(s) => s.clone(),
- RunDescriptor::Path(p) => p.to_string_lossy().to_string(),
+ RunDescriptor::Name(s) => f.write_str(s),
+ RunDescriptor::Path(p) => f.write_str(&p.display().to_string()),
}
}
}