From 8b39e7a1054487a74efea9613d93f1a8bdf0185b Mon Sep 17 00:00:00 2001 From: Jesse Date: Sat, 20 Mar 2021 20:48:02 +0900 Subject: [PATCH] refactor: update lints to embark lints 0.3 (#50) --- build/build.rs | 58 +++++++++++++++++++++++++++++++++++-- build/xcframework/common.rs | 3 +- src/bin/main.rs | 55 +++++++++++++++++++++++++++++++++++ src/lib.rs | 56 ++++++++++++++++++++++++++++++++++- 4 files changed, 167 insertions(+), 5 deletions(-) diff --git a/build/build.rs b/build/build.rs index c352ea5..7dc586f 100644 --- a/build/build.rs +++ b/build/build.rs @@ -1,3 +1,58 @@ +// BEGIN - Embark standard lints v0.3 +// do not change or add/remove here, but one can add exceptions after this section +// for more info see: +#![deny(unsafe_code)] +#![warn( + clippy::all, + clippy::await_holding_lock, + clippy::dbg_macro, + clippy::debug_assert_with_mut_call, + clippy::doc_markdown, + clippy::empty_enum, + clippy::enum_glob_use, + clippy::exit, + clippy::explicit_into_iter_loop, + clippy::filter_map_next, + clippy::fn_params_excessive_bools, + clippy::if_let_mutex, + clippy::imprecise_flops, + clippy::inefficient_to_string, + clippy::large_types_passed_by_value, + clippy::let_unit_value, + clippy::linkedlist, + clippy::lossy_float_literal, + clippy::macro_use_imports, + clippy::map_err_ignore, + clippy::map_flatten, + clippy::map_unwrap_or, + clippy::match_on_vec_items, + clippy::match_same_arms, + clippy::match_wildcard_for_single_variants, + clippy::mem_forget, + clippy::mismatched_target_os, + clippy::needless_borrow, + clippy::needless_continue, + clippy::option_option, + clippy::pub_enum_variant_names, + clippy::ref_option_ref, + clippy::rest_pat_in_fully_bound_structs, + clippy::string_add_assign, + clippy::string_add, + clippy::string_to_string, + clippy::suboptimal_flops, + clippy::todo, + clippy::unimplemented, + clippy::unnested_or_patterns, + clippy::unused_self, + clippy::verbose_file_reads, + future_incompatible, + nonstandard_style, + rust_2018_idioms +)] +// END - Embark standard lints v0.3 +// crate-specific exceptions: +#![allow(unsafe_code)] + mod xcframework; #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -277,11 +332,10 @@ fn main() { let native_libs = xcframework .AvailableLibraries .into_iter() - .map(|lib| { + .flat_map(|lib| { lib.universal_to_native(project_dir.clone()) .expect("Failed to get native library") }) - .flatten() .map(|lib| (lib.identifier(), lib.path())) .collect::>(); diff --git a/build/xcframework/common.rs b/build/xcframework/common.rs index db286b6..492ec4a 100644 --- a/build/xcframework/common.rs +++ b/build/xcframework/common.rs @@ -33,8 +33,7 @@ impl> From for Arch { match arch.as_ref() { "x86_64" => Arch::Amd64, "x86" => Arch::X86, - "arm64" => Arch::Arm64, - "aarch64" => Arch::Arm64, + "arm64" | "aarch64" => Arch::Arm64, "arm64e" => Arch::Arm64e, _ => Arch::Unknown, } diff --git a/src/bin/main.rs b/src/bin/main.rs index 4a52b6e..d080c0a 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -1,3 +1,58 @@ +// BEGIN - Embark standard lints v0.3 +// do not change or add/remove here, but one can add exceptions after this section +// for more info see: +#![deny(unsafe_code)] +#![warn( + clippy::all, + clippy::await_holding_lock, + clippy::dbg_macro, + clippy::debug_assert_with_mut_call, + clippy::doc_markdown, + clippy::empty_enum, + clippy::enum_glob_use, + clippy::exit, + clippy::explicit_into_iter_loop, + clippy::filter_map_next, + clippy::fn_params_excessive_bools, + clippy::if_let_mutex, + clippy::imprecise_flops, + clippy::inefficient_to_string, + clippy::large_types_passed_by_value, + clippy::let_unit_value, + clippy::linkedlist, + clippy::lossy_float_literal, + clippy::macro_use_imports, + clippy::map_err_ignore, + clippy::map_flatten, + clippy::map_unwrap_or, + clippy::match_on_vec_items, + clippy::match_same_arms, + clippy::match_wildcard_for_single_variants, + clippy::mem_forget, + clippy::mismatched_target_os, + clippy::needless_borrow, + clippy::needless_continue, + clippy::option_option, + clippy::pub_enum_variant_names, + clippy::ref_option_ref, + clippy::rest_pat_in_fully_bound_structs, + clippy::string_add_assign, + clippy::string_add, + clippy::string_to_string, + clippy::suboptimal_flops, + clippy::todo, + clippy::unimplemented, + clippy::unnested_or_patterns, + clippy::unused_self, + clippy::verbose_file_reads, + future_incompatible, + nonstandard_style, + rust_2018_idioms +)] +// END - Embark standard lints v0.3 +// crate-specific exceptions: +#![allow(unsafe_code)] + use ash::{ version::{EntryV1_0, InstanceV1_0}, vk, diff --git a/src/lib.rs b/src/lib.rs index c67912d..4c0b964 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,58 @@ -extern crate ash; +// BEGIN - Embark standard lints v0.3 +// do not change or add/remove here, but one can add exceptions after this section +// for more info see: +#![deny(unsafe_code)] +#![warn( + clippy::all, + clippy::await_holding_lock, + clippy::dbg_macro, + clippy::debug_assert_with_mut_call, + clippy::doc_markdown, + clippy::empty_enum, + clippy::enum_glob_use, + clippy::exit, + clippy::explicit_into_iter_loop, + clippy::filter_map_next, + clippy::fn_params_excessive_bools, + clippy::if_let_mutex, + clippy::imprecise_flops, + clippy::inefficient_to_string, + clippy::large_types_passed_by_value, + clippy::let_unit_value, + clippy::linkedlist, + clippy::lossy_float_literal, + clippy::macro_use_imports, + clippy::map_err_ignore, + clippy::map_flatten, + clippy::map_unwrap_or, + clippy::match_on_vec_items, + clippy::match_same_arms, + clippy::match_wildcard_for_single_variants, + clippy::mem_forget, + clippy::mismatched_target_os, + clippy::needless_borrow, + clippy::needless_continue, + clippy::option_option, + clippy::pub_enum_variant_names, + clippy::ref_option_ref, + clippy::rest_pat_in_fully_bound_structs, + clippy::string_add_assign, + clippy::string_add, + clippy::string_to_string, + clippy::suboptimal_flops, + clippy::todo, + clippy::unimplemented, + clippy::unnested_or_patterns, + clippy::unused_self, + clippy::verbose_file_reads, + future_incompatible, + nonstandard_style, + rust_2018_idioms +)] +// END - Embark standard lints v0.3 +// crate-specific exceptions: +#![allow(unsafe_code)] + use ash::{version::EntryV1_0, vk, Instance, InstanceError, RawPtr}; extern "system" {