Fix clippy warning (1.40 -> 1.54)
The clippy.toml suppresses warnings added in newer rust versions, so fixing the documented MSRV also shows new warnings.
This commit is contained in:
parent
b566c3c064
commit
fb1fdc8aed
@ -296,7 +296,7 @@ impl CDecl {
|
||||
) {
|
||||
let align_length = out.line_length_for_align();
|
||||
out.push_set_spaces(align_length);
|
||||
for (i, &(ref arg_ident, ref arg_ty)) in args.iter().enumerate() {
|
||||
for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
|
||||
if i != 0 {
|
||||
out.write(",");
|
||||
out.new_line();
|
||||
@ -315,7 +315,7 @@ impl CDecl {
|
||||
config: &Config,
|
||||
args: &[(Option<String>, CDecl)],
|
||||
) {
|
||||
for (i, &(ref arg_ident, ref arg_ty)) in args.iter().enumerate() {
|
||||
for (i, (arg_ident, arg_ty)) in args.iter().enumerate() {
|
||||
if i != 0 {
|
||||
out.write(", ");
|
||||
}
|
||||
|
@ -26,17 +26,15 @@ impl Dependencies {
|
||||
// Sort untagged enums and opaque structs into their own layers because they don't
|
||||
// depend on each other or anything else.
|
||||
let ordering = |a: &ItemContainer, b: &ItemContainer| match (a, b) {
|
||||
(&ItemContainer::Enum(ref x), &ItemContainer::Enum(ref y))
|
||||
(ItemContainer::Enum(x), ItemContainer::Enum(y))
|
||||
if x.tag.is_none() && y.tag.is_none() =>
|
||||
{
|
||||
x.path.cmp(&y.path)
|
||||
}
|
||||
(&ItemContainer::Enum(ref x), _) if x.tag.is_none() => Ordering::Less,
|
||||
(_, &ItemContainer::Enum(ref x)) if x.tag.is_none() => Ordering::Greater,
|
||||
(ItemContainer::Enum(x), _) if x.tag.is_none() => Ordering::Less,
|
||||
(_, ItemContainer::Enum(x)) if x.tag.is_none() => Ordering::Greater,
|
||||
|
||||
(&ItemContainer::OpaqueItem(ref x), &ItemContainer::OpaqueItem(ref y)) => {
|
||||
x.path.cmp(&y.path)
|
||||
}
|
||||
(ItemContainer::OpaqueItem(x), ItemContainer::OpaqueItem(y)) => x.path.cmp(&y.path),
|
||||
(&ItemContainer::OpaqueItem(_), _) => Ordering::Less,
|
||||
(_, &ItemContainer::OpaqueItem(_)) => Ordering::Greater,
|
||||
|
||||
|
@ -130,19 +130,19 @@ impl AnnotationSet {
|
||||
|
||||
pub fn list(&self, name: &str) -> Option<Vec<String>> {
|
||||
match self.annotations.get(name) {
|
||||
Some(&AnnotationValue::List(ref x)) => Some(x.clone()),
|
||||
Some(AnnotationValue::List(x)) => Some(x.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
pub fn atom(&self, name: &str) -> Option<Option<String>> {
|
||||
match self.annotations.get(name) {
|
||||
Some(&AnnotationValue::Atom(ref x)) => Some(x.clone()),
|
||||
Some(AnnotationValue::Atom(x)) => Some(x.clone()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
pub fn bool(&self, name: &str) -> Option<bool> {
|
||||
match self.annotations.get(name) {
|
||||
Some(&AnnotationValue::Bool(ref x)) => Some(*x),
|
||||
Some(AnnotationValue::Bool(x)) => Some(*x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ impl AnnotationSet {
|
||||
T: Default + FromStr,
|
||||
{
|
||||
match self.annotations.get(name) {
|
||||
Some(&AnnotationValue::Atom(ref x)) => Some(
|
||||
Some(AnnotationValue::Atom(x)) => Some(
|
||||
x.as_ref()
|
||||
.map_or(T::default(), |y| y.parse::<T>().ok().unwrap()),
|
||||
),
|
||||
|
@ -219,12 +219,12 @@ impl<T: Item + Clone> ItemMap<T> {
|
||||
F: FnMut(&T),
|
||||
{
|
||||
match self.data.get(path) {
|
||||
Some(&ItemValue::Cfg(ref items)) => {
|
||||
Some(ItemValue::Cfg(items)) => {
|
||||
for item in items {
|
||||
callback(item);
|
||||
}
|
||||
}
|
||||
Some(&ItemValue::Single(ref item)) => {
|
||||
Some(ItemValue::Single(item)) => {
|
||||
callback(item);
|
||||
}
|
||||
None => {}
|
||||
|
@ -157,7 +157,7 @@ fn main() {
|
||||
.long("lang")
|
||||
.value_name("LANGUAGE")
|
||||
.help("Specify the language to output bindings in")
|
||||
.possible_values(&["c++", "C++", "c", "C", "cython", "Cython"]),
|
||||
.possible_values(["c++", "C++", "c", "C", "cython", "Cython"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("cpp-compat")
|
||||
@ -176,7 +176,7 @@ fn main() {
|
||||
.long("style")
|
||||
.value_name("STYLE")
|
||||
.help("Specify the declaration style to use for bindings")
|
||||
.possible_values(&["Both", "both", "Tag", "tag", "Type", "type"]),
|
||||
.possible_values(["Both", "both", "Tag", "tag", "Type", "type"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("d")
|
||||
@ -253,7 +253,7 @@ fn main() {
|
||||
"Specify the profile to use when expanding macros. \
|
||||
Has no effect otherwise."
|
||||
)
|
||||
.possible_values(&["Debug", "debug", "Release", "release"]),
|
||||
.possible_values(["Debug", "debug", "Release", "release"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("quiet")
|
||||
|
@ -23,7 +23,7 @@ fn run_cbindgen(
|
||||
style: Option<Style>,
|
||||
) -> Vec<u8> {
|
||||
let program = Path::new(cbindgen_path);
|
||||
let mut command = Command::new(&program);
|
||||
let mut command = Command::new(program);
|
||||
match language {
|
||||
Language::Cxx => {}
|
||||
Language::C => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user