1
0
Fork 0
forked from wry/wry

autocommit 2022-03-29 15:40:59 CEST

This commit is contained in:
Julian Orth 2022-03-29 15:40:59 +02:00
parent 6ebf731aea
commit 9842264fad
39 changed files with 121 additions and 92 deletions

View file

@ -1,3 +1,16 @@
#![allow(
clippy::len_zero,
clippy::needless_lifetimes,
clippy::enum_variant_names,
clippy::useless_format,
clippy::redundant_clone,
clippy::collapsible_if,
clippy::unnecessary_to_owned,
clippy::match_like_matches_macro,
clippy::too_many_arguments,
clippy::iter_skip_next,
)]
extern crate core;
use std::fs::{File, OpenOptions};

View file

@ -149,7 +149,7 @@ fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> {
writeln!(f)?;
writeln!(f, "#[derive(Copy, Clone, Debug)]")?;
writeln!(f, "pub struct ExtProc {{")?;
for (name, _, _) in map.iter().copied() {
for (name, _, _) in map.iter() {
writeln!(f, " {}: *mut u8,", name)?;
}
writeln!(f, "}}")?;

View file

@ -432,15 +432,15 @@ fn write_type2<W: Write>(f: &mut W, lt: &str, ty: &Type) -> Result<()> {
Type::Fd => "Rc<OwnedFd>",
Type::Array(e) => {
write!(f, "Cow<{}, [", lt)?;
write_type2(f, lt, &e)?;
write_type2(f, lt, e)?;
write!(f, "]>")?;
return Ok(());
}
Type::DictEntry(k, v) => {
write!(f, "DictEntry<")?;
write_type2(f, lt, &k)?;
write_type2(f, lt, k)?;
write!(f, ", ")?;
write_type2(f, lt, &v)?;
write_type2(f, lt, v)?;
write!(f, ">")?;
return Ok(());
}
@ -450,7 +450,7 @@ fn write_type2<W: Write>(f: &mut W, lt: &str, ty: &Type) -> Result<()> {
if idx > 0 {
write!(f, ", ")?;
}
write_type2(f, lt, &fs)?;
write_type2(f, lt, fs)?;
}
write!(f, ")")?;
return Ok(());
@ -671,7 +671,7 @@ fn write_element<W: Write>(f: &mut W, element: Element, indent: &str) -> Result<
{
let indent = format!("{} ", indent);
for component in &element.components {
write_component(f, &element, &component, &indent)?;
write_component(f, &element, component, &indent)?;
}
write_module(f, element, &indent)?;
}

View file

@ -362,9 +362,7 @@ impl<'a> Parser<'a> {
}
Ok(Type::String(len))
})();
let ty =
ty.with_context(|| format!("While parsing string starting in line {}", line))?;
ty
ty.with_context(|| format!("While parsing string starting in line {}", line))?
}
b"list" => {
let (line, body) = self.expect_tree(TreeDelim::Paren)?;
@ -381,9 +379,7 @@ impl<'a> Parser<'a> {
}
Ok(Type::List(Box::new(ty), len))
})();
let ty =
ty.with_context(|| format!("While parsing list starting in line {}", line))?;
ty
ty.with_context(|| format!("While parsing list starting in line {}", line))?
}
b"bitmask" => {
let (line, body) = self.expect_tree(TreeDelim::Paren)?;
@ -397,9 +393,7 @@ impl<'a> Parser<'a> {
}
Ok(Type::Bitmask(name.to_owned(), len))
})();
let ty =
ty.with_context(|| format!("While parsing bitmask starting in line {}", line))?;
ty
ty.with_context(|| format!("While parsing bitmask starting in line {}", line))?
}
b"enum" => {
let (line, body) = self.expect_tree(TreeDelim::Paren)?;
@ -413,9 +407,7 @@ impl<'a> Parser<'a> {
}
Ok(Type::Enum(Box::new(ty), len))
})();
let ty =
ty.with_context(|| format!("While parsing enum starting in line {}", line))?;
ty
ty.with_context(|| format!("While parsing enum starting in line {}", line))?
}
_ => Type::Named(ty.to_owned()),
};