Skip to content

Commit

Permalink
Address lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Jul 26, 2024
1 parent 47936d2 commit d398915
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ impl Parser {
quote! {
//! Automatically generated code; do not edit!

#![allow(clippy::wrong_self_convention, clippy::transmute_ptr_to_ptr)]
#![allow(clippy::wrong_self_convention, clippy::transmute_ptr_to_ptr, clippy::missing_transmute_annotations)]
use std::borrow::Cow;
use std::ffi::CStr;
use std::mem::MaybeUninit;
Expand Down
7 changes: 6 additions & 1 deletion openxr/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl Entry {
///
/// For all core OpenXR instance functions, `get_instance_proc_addr` must yield function
/// pointers that satisfy the semantics given in the OpenXR specification.
#[allow(clippy::missing_transmute_annotations)]
pub unsafe fn from_get_instance_proc_addr(
get_instance_proc_addr: sys::pfn::GetInstanceProcAddr,
) -> Result<Self> {
Expand Down Expand Up @@ -271,7 +272,11 @@ impl Entry {
)
},
)?;
Ok(ExtensionSet::from_properties(mem::transmute(&exts[..])))
// https://github.com/rust-lang/rust/issues/63569
Ok(ExtensionSet::from_properties(mem::transmute::<
&[std::mem::MaybeUninit<sys::ExtensionProperties>],
&[sys::ExtensionProperties],
>(&exts[..])))
}
}

Expand Down
6 changes: 3 additions & 3 deletions openxr/src/frame_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<G: Graphics> FrameStream<G> {
environment_blend_mode: EnvironmentBlendMode,
layers: &[&CompositionLayerBase<'_, G>],
) -> Result<()> {
assert!(layers.len() <= u32::max_value() as usize);
assert!(layers.len() <= u32::MAX as usize);
let info = sys::FrameEndInfo {
ty: sys::FrameEndInfo::TYPE,
next: ptr::null(),
Expand Down Expand Up @@ -139,8 +139,8 @@ impl<G: Graphics> FrameStream<G> {
layers: &[&CompositionLayerBase<'_, G>],
secondary_info: SecondaryEndInfo<'_, '_, '_, G>,
) -> Result<()> {
assert!(layers.len() <= u32::max_value() as usize);
assert!(secondary_info.layers.len() <= u32::max_value() as usize);
assert!(layers.len() <= u32::MAX as usize);
assert!(secondary_info.layers.len() <= u32::MAX as usize);
let single_secondary_info = [sys::SecondaryViewConfigurationLayerInfoMSFT {
ty: sys::SecondaryViewConfigurationLayerInfoMSFT::TYPE,
next: ptr::null(),
Expand Down
6 changes: 5 additions & 1 deletion openxr/src/generated.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#![doc = r" Automatically generated code; do not edit!"]
#![allow(clippy::wrong_self_convention, clippy::transmute_ptr_to_ptr)]
#![allow(
clippy::wrong_self_convention,
clippy::transmute_ptr_to_ptr,
clippy::missing_transmute_annotations
)]
use crate::*;
use std::borrow::Cow;
use std::ffi::CStr;
Expand Down
2 changes: 1 addition & 1 deletion sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Duration {

impl Duration {
pub const NONE: Self = Self(0);
pub const INFINITE: Self = Self(i64::max_value());
pub const INFINITE: Self = Self(i64::MAX);
pub const MIN_HAPTIC: Self = Self(-1);
}

Expand Down

0 comments on commit d398915

Please sign in to comment.