Skip to content

Commit

Permalink
All hail clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gwihlidal committed Dec 7, 2018
1 parent 7726ca9 commit b8efd09
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
36 changes: 20 additions & 16 deletions src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ pub(crate) fn ffi_to_interface_variable(
array: ffi_to_array_traits(ffi_type.array),
members,
format: ffi_to_format(ffi_type.format),
type_description: match ffi_type.type_description.is_null() {
true => None,
false => Some(ffi_to_type_description(unsafe {
type_description: if ffi_type.type_description.is_null() {
None
} else {
Some(ffi_to_type_description(unsafe {
&*ffi_type.type_description
})),
}))
},
word_offset: ffi_type.word_offset.location,
internal_data: ffi_type_ptr,
Expand Down Expand Up @@ -145,17 +146,19 @@ pub(crate) fn ffi_to_descriptor_binding(
array: ffi_to_binding_array_traits(ffi_type.array),
count: ffi_type.count,
uav_counter_id: ffi_type.uav_counter_id,
uav_counter_binding: match ffi_type.uav_counter_binding.is_null() {
true => None,
false => Some(Box::new(ffi_to_descriptor_binding(
uav_counter_binding: if ffi_type.uav_counter_binding.is_null() {
None
} else {
Some(Box::new(ffi_to_descriptor_binding(
ffi_type.uav_counter_binding,
))),
)))
},
type_description: match ffi_type.type_description.is_null() {
true => None,
false => Some(ffi_to_type_description(unsafe {
type_description: if ffi_type.type_description.is_null() {
None
} else {
Some(ffi_to_type_description(unsafe {
&*ffi_type.type_description
})),
}))
},
word_offset: (ffi_type.word_offset.binding, ffi_type.word_offset.set),
internal_data: ffi_type_ptr,
Expand Down Expand Up @@ -464,11 +467,12 @@ pub(crate) fn ffi_to_block_variable(
numeric: ffi_to_numeric_traits(ffi_type.numeric),
array: ffi_to_array_traits(ffi_type.array),
members,
type_description: match ffi_type.type_description.is_null() {
true => None,
false => Some(ffi_to_type_description(unsafe {
type_description: if ffi_type.type_description.is_null() {
None
} else {
Some(ffi_to_type_description(unsafe {
&*ffi_type.type_description
})),
}))
},
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod convert;
pub mod ffi;
pub mod types;

#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn ffi_to_string(ffi: *const ::std::os::raw::c_char) -> String {
if ffi.is_null() {
String::new()
Expand Down
26 changes: 13 additions & 13 deletions src/types/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ bitflags! {
const VECTOR = 256;
const MATRIX = 512;
const EXTERNAL_IMAGE = 65536;
const EXTERNAL_SAMPLER = 131072;
const EXTERNAL_SAMPLED_IMAGE = 262144;
const EXTERNAL_BLOCK = 524288;
const EXTERNAL_MASK = 983040;
const STRUCT = 268435456;
const ARRAY = 536870912;
const EXTERNAL_SAMPLER = 131_072;
const EXTERNAL_SAMPLED_IMAGE = 262_144;
const EXTERNAL_BLOCK = 524_288;
const EXTERNAL_MASK = 983_040;
const STRUCT = 268_435_456;
const ARRAY = 536_870_912;
}
}

Expand All @@ -54,13 +54,13 @@ impl Default for ReflectTypeFlags {
bitflags! {
#[derive(Serialize)]
pub struct ReflectShaderStageFlags: u32 {
const UNDEFINED = 0x00000000;
const VERTEX = 0x00000001;
const TESSELLATION_CONTROL = 0x00000002;
const TESSELLATION_EVALUATION = 0x00000004;
const GEOMETRY = 0x00000008;
const FRAGMENT = 0x00000010;
const COMPUTE = 0x00000020;
const UNDEFINED = 0x0000_0000;
const VERTEX = 0x0000_0001;
const TESSELLATION_CONTROL = 0x0000_0002;
const TESSELLATION_EVALUATION = 0x0000_0004;
const GEOMETRY = 0x0000_0008;
const FRAGMENT = 0x0000_0010;
const COMPUTE = 0x0000_0020;
}
}

Expand Down

0 comments on commit b8efd09

Please sign in to comment.