Skip to content

Commit

Permalink
make unit a unused phantomdata in fmt::Arguments
Browse files Browse the repository at this point in the history
the value of that type is never use, only the actual type parameter `N`
  • Loading branch information
hellow554 committed Nov 3, 2023
1 parent 639c6b3 commit 5bb0d88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,11 @@ macro_rules! quantity {
where
N: Unit
{
let _ = unit;
__system::fmt::Arguments {
dimension: $crate::lib::marker::PhantomData,
unit,
style,
dimension: $crate::lib::marker::PhantomData,
_unit: $crate::lib::marker::PhantomData,
}
}

Expand Down Expand Up @@ -384,11 +385,12 @@ macro_rules! quantity {
where
N: Unit
{
let _ = unit;
__system::fmt::QuantityArguments {
arguments: __system::fmt::Arguments {
dimension: $crate::lib::marker::PhantomData,
unit,
style,
dimension: $crate::lib::marker::PhantomData,
_unit: $crate::lib::marker::PhantomData,
},
quantity: self,
}
Expand Down
6 changes: 3 additions & 3 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,11 +1423,11 @@ macro_rules! system {
pub struct Arguments<D, N>
where
D: Dimension + ?Sized,
N: Unit,
N: Unit + ?Sized,
{
pub(super) dimension: $crate::lib::marker::PhantomData<D>,
pub(super) unit: N,
pub(super) style: DisplayStyle,
pub(super) dimension: $crate::lib::marker::PhantomData<D>,
pub(super) _unit: $crate::lib::marker::PhantomData<N>,
}

/// A struct to specify a display style and unit for a given quantity.
Expand Down

0 comments on commit 5bb0d88

Please sign in to comment.