Skip to content

Commit

Permalink
refactor: destruct tuples to enhance readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech committed Nov 2, 2024
1 parent 8e7585e commit e4aa2ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/cli/systemd_dbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ pub struct UnitFile {
}

impl From<(String, String)> for UnitFile {
fn from(value: (String, String)) -> Self {
Self {
file_name: value.0,
status: value.1,
}
fn from((file_name, status): (String, String)) -> Self {
Self { file_name, status }
}
}
4 changes: 2 additions & 2 deletions src/quadlet/container/mount/tmpfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ impl<'de> de::Visitor<'de> for Visitor {
Field::Mode => {
check_duplicate(&mode, Field::Mode)?;
// serde(with = "mode")
let value: SerdeMode = map.next_value()?;
mode = Some(value.0);
let SerdeMode(value) = map.next_value()?;
mode = Some(value);
}
// tmpcopyup, notmpcopyup values (de)serialize as unit (i.e. no value)
Field::TmpCopyUp => tmpcopyup = true,
Expand Down
2 changes: 1 addition & 1 deletion src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
S: Serializer,
{
let iter = value.into_iter();
let len = iter.size_hint().1;
let (_, len) = iter.size_hint();

let mut state = serializer.serialize_seq(len)?;

Expand Down

0 comments on commit e4aa2ef

Please sign in to comment.