Skip to content

Commit 5bb0d88

Browse files
committed
make unit a unused phantomdata in fmt::Arguments
the value of that type is never use, only the actual type parameter `N`
1 parent 639c6b3 commit 5bb0d88

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/quantity.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,11 @@ macro_rules! quantity {
343343
where
344344
N: Unit
345345
{
346+
let _ = unit;
346347
__system::fmt::Arguments {
347-
dimension: $crate::lib::marker::PhantomData,
348-
unit,
349348
style,
349+
dimension: $crate::lib::marker::PhantomData,
350+
_unit: $crate::lib::marker::PhantomData,
350351
}
351352
}
352353

@@ -384,11 +385,12 @@ macro_rules! quantity {
384385
where
385386
N: Unit
386387
{
388+
let _ = unit;
387389
__system::fmt::QuantityArguments {
388390
arguments: __system::fmt::Arguments {
389-
dimension: $crate::lib::marker::PhantomData,
390-
unit,
391391
style,
392+
dimension: $crate::lib::marker::PhantomData,
393+
_unit: $crate::lib::marker::PhantomData,
392394
},
393395
quantity: self,
394396
}

src/system.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1423,11 +1423,11 @@ macro_rules! system {
14231423
pub struct Arguments<D, N>
14241424
where
14251425
D: Dimension + ?Sized,
1426-
N: Unit,
1426+
N: Unit + ?Sized,
14271427
{
1428-
pub(super) dimension: $crate::lib::marker::PhantomData<D>,
1429-
pub(super) unit: N,
14301428
pub(super) style: DisplayStyle,
1429+
pub(super) dimension: $crate::lib::marker::PhantomData<D>,
1430+
pub(super) _unit: $crate::lib::marker::PhantomData<N>,
14311431
}
14321432

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

0 commit comments

Comments
 (0)