Fix clippy lints for 1.43 (#298)
This commit is contained in:
parent
e378a85c78
commit
4d6bb3949d
File diff suppressed because it is too large
Load diff
|
@ -1,24 +1,24 @@
|
|||
use crate::vk::definitions::*;
|
||||
pub const MAX_PHYSICAL_DEVICE_NAME_SIZE: usize = (256);
|
||||
pub const UUID_SIZE: usize = (16);
|
||||
pub const LUID_SIZE: usize = (8);
|
||||
pub const MAX_EXTENSION_NAME_SIZE: usize = (256);
|
||||
pub const MAX_DESCRIPTION_SIZE: usize = (256);
|
||||
pub const MAX_MEMORY_TYPES: usize = (32);
|
||||
pub const MAX_MEMORY_HEAPS: usize = (16);
|
||||
pub const LOD_CLAMP_NONE: f32 = (1000.00);
|
||||
pub const REMAINING_MIP_LEVELS: u32 = (!0);
|
||||
pub const REMAINING_ARRAY_LAYERS: u32 = (!0);
|
||||
pub const WHOLE_SIZE: u64 = (!0);
|
||||
pub const ATTACHMENT_UNUSED: u32 = (!0);
|
||||
pub const TRUE: Bool32 = (1);
|
||||
pub const FALSE: Bool32 = (0);
|
||||
pub const QUEUE_FAMILY_IGNORED: u32 = (!0);
|
||||
pub const QUEUE_FAMILY_EXTERNAL: u32 = (!0 - 1);
|
||||
pub const QUEUE_FAMILY_FOREIGN_EXT: u32 = (!0 - 2);
|
||||
pub const SUBPASS_EXTERNAL: u32 = (!0);
|
||||
pub const MAX_DEVICE_GROUP_SIZE: usize = (32);
|
||||
pub const MAX_DRIVER_NAME_SIZE: usize = (256);
|
||||
pub const MAX_DRIVER_INFO_SIZE: usize = (256);
|
||||
pub const SHADER_UNUSED_KHR: u32 = (!0);
|
||||
pub const MAX_PHYSICAL_DEVICE_NAME_SIZE: usize = 256;
|
||||
pub const UUID_SIZE: usize = 16;
|
||||
pub const LUID_SIZE: usize = 8;
|
||||
pub const MAX_EXTENSION_NAME_SIZE: usize = 256;
|
||||
pub const MAX_DESCRIPTION_SIZE: usize = 256;
|
||||
pub const MAX_MEMORY_TYPES: usize = 32;
|
||||
pub const MAX_MEMORY_HEAPS: usize = 16;
|
||||
pub const LOD_CLAMP_NONE: f32 = 1000.00;
|
||||
pub const REMAINING_MIP_LEVELS: u32 = !0;
|
||||
pub const REMAINING_ARRAY_LAYERS: u32 = !0;
|
||||
pub const WHOLE_SIZE: u64 = !0;
|
||||
pub const ATTACHMENT_UNUSED: u32 = !0;
|
||||
pub const TRUE: Bool32 = 1;
|
||||
pub const FALSE: Bool32 = 0;
|
||||
pub const QUEUE_FAMILY_IGNORED: u32 = !0;
|
||||
pub const QUEUE_FAMILY_EXTERNAL: u32 = !0 - 1;
|
||||
pub const QUEUE_FAMILY_FOREIGN_EXT: u32 = !0 - 2;
|
||||
pub const SUBPASS_EXTERNAL: u32 = !0;
|
||||
pub const MAX_DEVICE_GROUP_SIZE: usize = 32;
|
||||
pub const MAX_DRIVER_NAME_SIZE: usize = 256;
|
||||
pub const MAX_DRIVER_INFO_SIZE: usize = 256;
|
||||
pub const SHADER_UNUSED_KHR: u32 = !0;
|
||||
pub const SHADER_UNUSED_NV: u32 = SHADER_UNUSED_KHR;
|
||||
|
|
1355
ash/src/vk/enums.rs
1355
ash/src/vk/enums.rs
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -38,7 +38,6 @@ use std::cell::RefCell;
|
|||
use std::default::Default;
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::ops::Drop;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
// Simple offset_of macro akin to C++ offsetof
|
||||
#[macro_export]
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
#[macro_use]
|
||||
extern crate nom;
|
||||
use proc_macro2;
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
use syn;
|
||||
pub use vk_parse;
|
||||
pub use vkxml;
|
||||
|
||||
|
@ -390,20 +388,21 @@ impl ConstVal {
|
|||
}
|
||||
}
|
||||
pub trait ConstantExt {
|
||||
fn constant(&self) -> Constant;
|
||||
fn variant_ident(&self, enum_name: &str) -> Ident;
|
||||
fn to_tokens(&self, ident: Option<Ident>) -> Tokens;
|
||||
fn to_tokens(&self) -> Tokens;
|
||||
fn notation(&self) -> Option<&str>;
|
||||
}
|
||||
|
||||
impl ConstantExt for vkxml::ExtensionEnum {
|
||||
fn constant(&self) -> Constant {
|
||||
Constant::from_extension_enum(self).unwrap()
|
||||
}
|
||||
fn variant_ident(&self, enum_name: &str) -> Ident {
|
||||
variant_ident(enum_name, &self.name)
|
||||
}
|
||||
fn to_tokens(&self, ident: Option<Ident>) -> Tokens {
|
||||
let expr = Constant::from_extension_enum(self)
|
||||
.expect("")
|
||||
.to_tokens(ident);
|
||||
quote! { #ident(#expr) }
|
||||
fn to_tokens(&self) -> Tokens {
|
||||
Constant::from_extension_enum(self).expect("").to_tokens()
|
||||
}
|
||||
fn notation(&self) -> Option<&str> {
|
||||
self.notation.as_deref()
|
||||
|
@ -411,19 +410,21 @@ impl ConstantExt for vkxml::ExtensionEnum {
|
|||
}
|
||||
|
||||
impl ConstantExt for vkxml::Constant {
|
||||
fn constant(&self) -> Constant {
|
||||
Constant::from_constant(self)
|
||||
}
|
||||
fn variant_ident(&self, enum_name: &str) -> Ident {
|
||||
variant_ident(enum_name, &self.name)
|
||||
}
|
||||
fn to_tokens(&self, ident: Option<Ident>) -> Tokens {
|
||||
let expr = Constant::from_constant(self).to_tokens(ident);
|
||||
quote! { #expr }
|
||||
fn to_tokens(&self) -> Tokens {
|
||||
Constant::from_constant(self).to_tokens()
|
||||
}
|
||||
fn notation(&self) -> Option<&str> {
|
||||
self.notation.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Constant {
|
||||
Number(i32),
|
||||
Hex(String),
|
||||
|
@ -479,32 +480,32 @@ impl Constant {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn to_tokens(&self, ident: Option<Ident>) -> Tokens {
|
||||
pub fn to_tokens(&self) -> Tokens {
|
||||
match *self {
|
||||
Constant::Number(n) => {
|
||||
let number = interleave_number('_', 3, &n.to_string());
|
||||
let term = Term::intern(&number);
|
||||
quote! {#ident(#term)}
|
||||
quote! {#term}
|
||||
}
|
||||
Constant::Hex(ref s) => {
|
||||
let number = interleave_number('_', 4, s);
|
||||
let term = Term::intern(&format!("0x{}", number));
|
||||
quote! {#ident(#term)}
|
||||
quote! {#term}
|
||||
}
|
||||
Constant::Text(ref text) => {
|
||||
quote! {#ident(#text)}
|
||||
quote! {#text}
|
||||
}
|
||||
Constant::CExpr(ref expr) => {
|
||||
let (_, (_, rexpr)) = cexpr(expr).expect("Unable to parse cexpr");
|
||||
let term = Term::intern(rexpr.as_str());
|
||||
quote! {#ident(#term)}
|
||||
quote! {#term}
|
||||
}
|
||||
Constant::BitPos(pos) => {
|
||||
let value = 1 << pos;
|
||||
let bit_string = format!("{:b}", value);
|
||||
let bit_string = interleave_number('_', 4, &bit_string);
|
||||
let term = Term::intern(&format!("0b{}", bit_string));
|
||||
quote! {#ident(#term)}
|
||||
quote! {#term}
|
||||
}
|
||||
Constant::Alias(ref base, ref value) => {
|
||||
quote! {#base::#value}
|
||||
|
@ -938,11 +939,14 @@ pub struct ExtensionConstant<'a> {
|
|||
pub constant: Constant,
|
||||
}
|
||||
impl<'a> ConstantExt for ExtensionConstant<'a> {
|
||||
fn constant(&self) -> Constant {
|
||||
self.constant.clone()
|
||||
}
|
||||
fn variant_ident(&self, enum_name: &str) -> Ident {
|
||||
variant_ident(enum_name, self.name)
|
||||
}
|
||||
fn to_tokens(&self, ident: Option<Ident>) -> Tokens {
|
||||
self.constant.to_tokens(ident)
|
||||
fn to_tokens(&self) -> Tokens {
|
||||
self.constant.to_tokens()
|
||||
}
|
||||
fn notation(&self) -> Option<&str> {
|
||||
None
|
||||
|
@ -1208,7 +1212,13 @@ pub fn bitflags_impl_block(
|
|||
.iter()
|
||||
.map(|constant| {
|
||||
let variant_ident = constant.variant_ident(enum_name);
|
||||
let tokens = constant.to_tokens(Some(ident));
|
||||
let constant = constant.constant();
|
||||
let tokens = constant.to_tokens();
|
||||
let tokens = if let Constant::Alias(_, _) = &constant {
|
||||
tokens
|
||||
} else {
|
||||
quote!(Self(#tokens))
|
||||
};
|
||||
(variant_ident, tokens)
|
||||
})
|
||||
.collect_vec();
|
||||
|
@ -2125,7 +2135,7 @@ pub fn generate_constant<'a>(
|
|||
let c = Constant::from_constant(constant);
|
||||
let name = constant_name(&constant.name);
|
||||
let ident = Ident::from(name.as_str());
|
||||
let value = c.to_tokens(None);
|
||||
let value = c.to_tokens();
|
||||
let ty = if name == "TRUE" || name == "FALSE" {
|
||||
CType::Bool32
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue