Skip to content

Commit

Permalink
Run rustfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfbiedert committed Jan 31, 2025
1 parent 8db89a3 commit 6702db2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 6 additions & 3 deletions crates/core/src/patterns/api_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ pub struct APIVersion {

impl APIVersion {
/// Create a new API version from the given hash.
#[must_use] pub const fn new(version: u64) -> Self {
#[must_use]
pub const fn new(version: u64) -> Self {
Self { version }
}

/// Create a new API version from the given library.
#[must_use] pub fn from_inventory(inventory: &Inventory) -> Self {
#[must_use]
pub fn from_inventory(inventory: &Inventory) -> Self {
let version = inventory_hash(inventory);
Self { version }
}
Expand All @@ -90,7 +92,8 @@ impl From<Inventory> for APIVersion {
}

/// Returns a unique hash for an inventory; used by backends.
#[must_use] pub fn inventory_hash(inventory: &Inventory) -> u64 {
#[must_use]
pub fn inventory_hash(inventory: &Inventory) -> u64 {
let mut hasher = DefaultHasher::new();

let types = inventory.ctypes();
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/patterns/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ impl TypePattern {
/// C-equivalent fallback type.
///
/// This function will never return a [`CType::Pattern`] variant.
#[must_use] pub fn fallback_type(&self) -> CType {
#[must_use]
pub fn fallback_type(&self) -> CType {
match self {
Self::CStrPointer => CType::ReadPointer(Box::new(CType::Pattern(Self::CChar))),
Self::FFIErrorEnum(e) => CType::Enum(e.the_enum().clone()),
Expand Down
12 changes: 8 additions & 4 deletions crates/core/src/patterns/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,27 @@ pub struct FFIErrorEnum {
}

impl FFIErrorEnum {
#[must_use] pub const fn new(the_enum: EnumType, success_variant: Variant, panic_variant: Variant) -> Self {
#[must_use]
pub const fn new(the_enum: EnumType, success_variant: Variant, panic_variant: Variant) -> Self {
Self {
the_enum,
success_variant,
panic_variant,
}
}

#[must_use] pub const fn the_enum(&self) -> &EnumType {
#[must_use]
pub const fn the_enum(&self) -> &EnumType {
&self.the_enum
}

#[must_use] pub const fn success_variant(&self) -> &Variant {
#[must_use]
pub const fn success_variant(&self) -> &Variant {
&self.success_variant
}

#[must_use] pub const fn panic_variant(&self) -> &Variant {
#[must_use]
pub const fn panic_variant(&self) -> &Variant {
&self.panic_variant
}
}
Expand Down

0 comments on commit 6702db2

Please sign in to comment.