Skip to content

Commit

Permalink
clippy: derive Default
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Dec 25, 2023
1 parent 2eccd07 commit 8286105
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
9 changes: 2 additions & 7 deletions taskchampion/lib/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,16 @@ impl TCString {
}
}

#[derive(PartialEq, Eq, Debug)]
#[derive(PartialEq, Eq, Debug, Default)]
pub enum RustString<'a> {
#[default]
Null,
CString(CString),
CStr(&'a CStr),
String(String),
Bytes(Vec<u8>),
}

impl<'a> Default for RustString<'a> {
fn default() -> Self {
RustString::Null
}
}

impl PassByValue for TCString {
type RustType = RustString<'static>;

Expand Down
7 changes: 2 additions & 5 deletions taskchampion/taskchampion/src/server/cloud/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ impl<SVC: Service> CloudServer<SVC> {
/// Get the possible child versions of the given parent version, based only on the object
/// names.
fn get_child_versions(&mut self, parent_version_id: &VersionId) -> Result<Vec<VersionId>> {
self
.service
self.service
.list(format!("v-{}-", parent_version_id.as_simple()).as_bytes())
.filter_map(|res| match res {
Ok(ObjectInfo { name, .. }) => {
Expand Down Expand Up @@ -280,9 +279,7 @@ impl<SVC: Service> CloudServer<SVC> {
.service
.list(b"s-")
.filter_map(|res| match res {
Ok(ObjectInfo { name, .. }) => {
Self::parse_snapshot_name(&name).map(Ok)
}
Ok(ObjectInfo { name, .. }) => Self::parse_snapshot_name(&name).map(Ok),
Err(e) => Some(Err(e)),
})
.collect::<Result<HashSet<_>>>()?;
Expand Down

0 comments on commit 8286105

Please sign in to comment.