mirror of
https://github.com/aphrody-labs/cef-rs.git
synced 2026-10-13 21:06:46 +00:00
fix: cargo clippy -p update-bindings --fix
This commit is contained in:
3 files changed
+13
-15
No files matched your search
@@ -9,7 +9,7 @@ pub fn get_out_dir() -> PathBuf {
|
||||
}
|
||||
|
||||
pub fn get_cef_root(os: &str, arch: &str) -> PathBuf {
|
||||
env::var(&format!("CEF_PATH_{os}_{arch}"))
|
||||
env::var(format!("CEF_PATH_{os}_{arch}"))
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| {
|
||||
let mut out_dir = get_out_dir();
|
||||
|
||||
@@ -141,7 +141,7 @@ impl SignatureRef<'_> {
|
||||
.map(|arg| {
|
||||
Some(MergedParam::Single {
|
||||
name: make_snake_case_value_name(&arg.name),
|
||||
ty: tree.resolve_modified_type(&arg.ty),
|
||||
ty: tree.resolve_modified_type(arg.ty),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1210,9 +1210,9 @@ impl<'a> TryFrom<&'a syn::Field> for SignatureRef<'a> {
|
||||
else {
|
||||
return Err(Unrecognized::FieldType);
|
||||
};
|
||||
if ident_std.to_string() != "std"
|
||||
|| ident_option.to_string() != "option"
|
||||
|| ident_type.to_string() != "Option"
|
||||
if *ident_std != "std"
|
||||
|| *ident_option != "option"
|
||||
|| *ident_type != "Option"
|
||||
|| args.len() != 1
|
||||
{
|
||||
return Err(Unrecognized::FieldType);
|
||||
@@ -1594,7 +1594,7 @@ struct ParseTree<'a> {
|
||||
base_types: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
impl<'a> ParseTree<'a> {
|
||||
impl ParseTree<'_> {
|
||||
pub fn write_prelude(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
let header = quote! {
|
||||
#![allow(
|
||||
@@ -1647,7 +1647,7 @@ impl<'a> ParseTree<'a> {
|
||||
.lookup_type_alias
|
||||
.get(&ty)
|
||||
.and_then(|&i| self.type_aliases.get(i))
|
||||
.map(|alias| self.resolve_type_aliases(&alias.ty))
|
||||
.map(|alias| self.resolve_type_aliases(alias.ty))
|
||||
.unwrap_or_else(|| path.to_token_stream()),
|
||||
_ => path.to_token_stream(),
|
||||
}
|
||||
@@ -3034,13 +3034,13 @@ impl<'a> ParseTree<'a> {
|
||||
}
|
||||
|
||||
pub fn write_globals(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
let pattern = Regex::new(r"^cef_(\w+)$").unwrap();
|
||||
|
||||
for global_fn in self.global_function_declarations.iter() {
|
||||
let original_name = global_fn.name.as_str();
|
||||
writeln!(f, "\n/// See [{original_name}] for more documentation.")?;
|
||||
static PATTERN: OnceLock<Regex> = OnceLock::new();
|
||||
let pattern = PATTERN.get_or_init(|| Regex::new(r"^cef_(\w+)$").unwrap());
|
||||
let name = pattern
|
||||
.captures(&original_name)
|
||||
.captures(original_name)
|
||||
.and_then(|captures| captures.get(1))
|
||||
.map(|name| name.as_str())
|
||||
.unwrap_or(original_name);
|
||||
@@ -3109,7 +3109,7 @@ impl<'a> ParseTree<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Display for ParseTree<'a> {
|
||||
impl Display for ParseTree<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
self.write_prelude(f)?;
|
||||
self.write_aliases(f)?;
|
||||
|
||||
@@ -29,11 +29,9 @@ pub fn download(target: &str) -> PathBuf {
|
||||
true,
|
||||
)
|
||||
.expect("download failed");
|
||||
let archive_dir =
|
||||
download_cef::extract_target_archive(target, &archive, dirs::get_out_dir(), true)
|
||||
.expect("extraction failed");
|
||||
|
||||
archive_dir
|
||||
download_cef::extract_target_archive(target, &archive, dirs::get_out_dir(), true)
|
||||
.expect("extraction failed")
|
||||
}
|
||||
|
||||
pub fn sys_bindgen(target: &str) -> crate::Result<()> {
|
||||
|
||||
Reference in new issue
Block a user