Fix clippy lints on Rust 1.54 and beyond (#458)
Using `cargo +nightly clippy --fix --all` on `clippy 0.1.56 (4927238 2021-07-29)`.
This commit is contained in:
parent
8a1e4a3eba
commit
9c1abcd9ca
3 changed files with 8 additions and 8 deletions
|
@ -959,7 +959,7 @@ impl fmt::Display for Result {
|
||||||
if let Some(x) = name {
|
if let Some(x) = name {
|
||||||
fmt.write_str(x)
|
fmt.write_str(x)
|
||||||
} else {
|
} else {
|
||||||
<Self as fmt::Debug>::fmt(&self, fmt)
|
<Self as fmt::Debug>::fmt(self, fmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ impl ExampleBase {
|
||||||
.get_physical_device_queue_family_properties(*pdevice)
|
.get_physical_device_queue_family_properties(*pdevice)
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(index, ref info)| {
|
.filter_map(|(index, info)| {
|
||||||
let supports_graphic_and_surface =
|
let supports_graphic_and_surface =
|
||||||
info.queue_flags.contains(vk::QueueFlags::GRAPHICS)
|
info.queue_flags.contains(vk::QueueFlags::GRAPHICS)
|
||||||
&& surface_loader
|
&& surface_loader
|
||||||
|
|
|
@ -494,7 +494,7 @@ impl Constant {
|
||||||
pub fn value(&self) -> Option<ConstVal> {
|
pub fn value(&self) -> Option<ConstVal> {
|
||||||
match *self {
|
match *self {
|
||||||
Constant::Number(n) => Some(ConstVal::U64(n as u64)),
|
Constant::Number(n) => Some(ConstVal::U64(n as u64)),
|
||||||
Constant::Hex(ref hex) => u64::from_str_radix(&hex, 16).ok().map(ConstVal::U64),
|
Constant::Hex(ref hex) => u64::from_str_radix(hex, 16).ok().map(ConstVal::U64),
|
||||||
Constant::BitPos(pos) => Some(ConstVal::U64(1u64 << pos)),
|
Constant::BitPos(pos) => Some(ConstVal::U64(1u64 << pos)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ impl Constant {
|
||||||
}
|
}
|
||||||
EnumSpec::Alias { alias, extends } => {
|
EnumSpec::Alias { alias, extends } => {
|
||||||
let base_type = extends.as_deref().or(enum_name)?;
|
let base_type = extends.as_deref().or(enum_name)?;
|
||||||
let key = variant_ident(base_type, &alias);
|
let key = variant_ident(base_type, alias);
|
||||||
if key == "DISPATCH_BASE" {
|
if key == "DISPATCH_BASE" {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
@ -1265,7 +1265,7 @@ pub fn generate_define(
|
||||||
let link = khronos_link(&define.name);
|
let link = khronos_link(&define.name);
|
||||||
let c_expr = c_expr.trim_start_matches('\\');
|
let c_expr = c_expr.trim_start_matches('\\');
|
||||||
let c_expr = c_expr.replace("(uint32_t)", "");
|
let c_expr = c_expr.replace("(uint32_t)", "");
|
||||||
let c_expr = convert_c_expression(&c_expr, &identifier_renames);
|
let c_expr = convert_c_expression(&c_expr, identifier_renames);
|
||||||
let c_expr = discard_outmost_delimiter(c_expr);
|
let c_expr = discard_outmost_delimiter(c_expr);
|
||||||
|
|
||||||
let deprecated = define
|
let deprecated = define
|
||||||
|
@ -1411,7 +1411,7 @@ pub fn variant_ident(enum_name: &str, variant_name: &str) -> Ident {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Both of the above strip_prefix leave a leading `_`:
|
// Both of the above strip_prefix leave a leading `_`:
|
||||||
let new_variant_name = new_variant_name.strip_prefix("_").unwrap();
|
let new_variant_name = new_variant_name.strip_prefix('_').unwrap();
|
||||||
// Replace _BIT anywhere in the string, also works when there's a trailing
|
// Replace _BIT anywhere in the string, also works when there's a trailing
|
||||||
// vendor extension in the variant name that's not in the enum/type name:
|
// vendor extension in the variant name that's not in the enum/type name:
|
||||||
let new_variant_name = new_variant_name.replace("_BIT", "");
|
let new_variant_name = new_variant_name.replace("_BIT", "");
|
||||||
|
@ -1592,7 +1592,7 @@ pub fn generate_result(ident: Ident, enum_: &vk_parse::Enums) -> TokenStream {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let variant_ident = variant_ident(&enum_.name.as_ref().unwrap(), variant_name);
|
let variant_ident = variant_ident(enum_.name.as_ref().unwrap(), variant_name);
|
||||||
Some(quote! {
|
Some(quote! {
|
||||||
#ident::#variant_ident => Some(#notation)
|
#ident::#variant_ident => Some(#notation)
|
||||||
})
|
})
|
||||||
|
@ -1611,7 +1611,7 @@ pub fn generate_result(ident: Ident, enum_: &vk_parse::Enums) -> TokenStream {
|
||||||
} else {
|
} else {
|
||||||
// If we don't have a nice message to show, call the generated `Debug` impl
|
// If we don't have a nice message to show, call the generated `Debug` impl
|
||||||
// which includes *all* enum variants, including those from extensions.
|
// which includes *all* enum variants, including those from extensions.
|
||||||
<Self as fmt::Debug>::fmt(&self, fmt)
|
<Self as fmt::Debug>::fmt(self, fmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue