Skip to content

Commit 48c0097

Browse files
lamco-officeralfbiedert
authored andcommitted
style(encoder): add #[must_use] to VUI types
Add #[must_use] attributes to VuiConfig struct and as_u8 methods on ColorPrimaries, TransferCharacteristics, and MatrixCoefficients to satisfy clippy lints for builder patterns and pure functions.
1 parent 2f10cb3 commit 48c0097

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

openh264/src/encoder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ pub enum ColorPrimaries {
443443

444444
impl ColorPrimaries {
445445
/// Get the raw u8 value for the VUI colour_primaries field.
446+
#[must_use]
446447
pub const fn as_u8(self) -> u8 {
447448
self as u8
448449
}
@@ -483,6 +484,7 @@ pub enum TransferCharacteristics {
483484

484485
impl TransferCharacteristics {
485486
/// Get the raw u8 value for the VUI transfer_characteristics field.
487+
#[must_use]
486488
pub const fn as_u8(self) -> u8 {
487489
self as u8
488490
}
@@ -519,6 +521,7 @@ pub enum MatrixCoefficients {
519521

520522
impl MatrixCoefficients {
521523
/// Get the raw u8 value for the VUI matrix_coefficients field.
524+
#[must_use]
522525
pub const fn as_u8(self) -> u8 {
523526
self as u8
524527
}
@@ -538,6 +541,7 @@ impl MatrixCoefficients {
538541
/// .vui(VuiConfig::bt709().with_full_range(true)); // HD BT.709 with full range
539542
/// ```
540543
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
544+
#[must_use]
541545
pub struct VuiConfig {
542546
/// Chromaticity coordinates of source primaries
543547
pub color_primaries: ColorPrimaries,

0 commit comments

Comments
 (0)