Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 14, 2023
1 parent 8e49fa5 commit e056d0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 4 additions & 6 deletions crates/header-translator/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl MethodModifiers {
fn parse(entity: &Entity<'_>, context: &Context<'_>) -> Self {
let mut this = Self::default();

immediate_children(&entity, |entity, _span| match entity.get_kind() {
immediate_children(entity, |entity, _span| match entity.get_kind() {
EntityKind::UnexposedAttr => {
if let Some(attr) = UnexposedAttr::parse(&entity, context) {
match attr {
Expand Down Expand Up @@ -610,12 +610,10 @@ impl fmt::Display for Method {
error!("invalid mutating method");
}
// Insert nothing; a class method is assumed
} else if self.mutating {
write!(f, "&mut self, ")?;
} else {
if self.mutating {
write!(f, "&mut self, ")?;
} else {
write!(f, "&self, ")?;
}
write!(f, "&self, ")?;
}

// Arguments
Expand Down
9 changes: 2 additions & 7 deletions crates/header-translator/src/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ impl Drop for AttributeParser<'_, '_> {
}
}

#[derive(Deserialize, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Deserialize, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
#[serde(from = "bool")]
pub enum Ownership {
Owned,
#[default]
Shared,
}

Expand All @@ -168,12 +169,6 @@ impl From<bool> for Ownership {
}
}

impl Default for Ownership {
fn default() -> Self {
Ownership::Shared
}
}

impl fmt::Display for Ownership {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expand Down

0 comments on commit e056d0a

Please sign in to comment.