Skip to content

Commit 1f2c157

Browse files
committed
Upgrade to Embark standard lints v6
EmbarkStudios/rust-ecosystem#59
1 parent 3ce58c6 commit 1f2c157

File tree

4 files changed

+88
-117
lines changed

4 files changed

+88
-117
lines changed

.cargo/config.toml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
[target.'cfg(all())']
2+
rustflags = [
3+
# BEGIN - Embark standard lints v6 for Rust 1.55+
4+
# do not change or add/remove here, but one can add exceptions after this section
5+
# for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
6+
"-Dunsafe_code",
7+
"-Wclippy::all",
8+
"-Wclippy::await_holding_lock",
9+
"-Wclippy::char_lit_as_u8",
10+
"-Wclippy::checked_conversions",
11+
"-Wclippy::dbg_macro",
12+
"-Wclippy::debug_assert_with_mut_call",
13+
"-Wclippy::doc_markdown",
14+
"-Wclippy::empty_enum",
15+
"-Wclippy::enum_glob_use",
16+
"-Wclippy::exit",
17+
"-Wclippy::expl_impl_clone_on_copy",
18+
"-Wclippy::explicit_deref_methods",
19+
"-Wclippy::explicit_into_iter_loop",
20+
"-Wclippy::fallible_impl_from",
21+
"-Wclippy::filter_map_next",
22+
"-Wclippy::flat_map_option",
23+
"-Wclippy::float_cmp_const",
24+
"-Wclippy::fn_params_excessive_bools",
25+
"-Wclippy::from_iter_instead_of_collect",
26+
"-Wclippy::if_let_mutex",
27+
"-Wclippy::implicit_clone",
28+
"-Wclippy::imprecise_flops",
29+
"-Wclippy::inefficient_to_string",
30+
"-Wclippy::invalid_upcast_comparisons",
31+
"-Wclippy::large_digit_groups",
32+
"-Wclippy::large_stack_arrays",
33+
"-Wclippy::large_types_passed_by_value",
34+
"-Wclippy::let_unit_value",
35+
"-Wclippy::linkedlist",
36+
"-Wclippy::lossy_float_literal",
37+
"-Wclippy::macro_use_imports",
38+
"-Wclippy::manual_ok_or",
39+
"-Wclippy::map_err_ignore",
40+
"-Wclippy::map_flatten",
41+
"-Wclippy::map_unwrap_or",
42+
"-Wclippy::match_on_vec_items",
43+
"-Wclippy::match_same_arms",
44+
"-Wclippy::match_wild_err_arm",
45+
"-Wclippy::match_wildcard_for_single_variants",
46+
"-Wclippy::mem_forget",
47+
"-Wclippy::mismatched_target_os",
48+
"-Wclippy::missing_enforced_import_renames",
49+
"-Wclippy::mut_mut",
50+
"-Wclippy::mutex_integer",
51+
"-Wclippy::needless_borrow",
52+
"-Wclippy::needless_continue",
53+
"-Wclippy::needless_for_each",
54+
"-Wclippy::option_option",
55+
"-Wclippy::path_buf_push_overwrite",
56+
"-Wclippy::ptr_as_ptr",
57+
"-Wclippy::rc_mutex",
58+
"-Wclippy::ref_option_ref",
59+
"-Wclippy::rest_pat_in_fully_bound_structs",
60+
"-Wclippy::same_functions_in_if_condition",
61+
"-Wclippy::semicolon_if_nothing_returned",
62+
"-Wclippy::single_match_else",
63+
"-Wclippy::string_add_assign",
64+
"-Wclippy::string_add",
65+
"-Wclippy::string_lit_as_bytes",
66+
"-Wclippy::string_to_string",
67+
"-Wclippy::todo",
68+
"-Wclippy::trait_duplication_in_bounds",
69+
"-Wclippy::unimplemented",
70+
"-Wclippy::unnested_or_patterns",
71+
"-Wclippy::unused_self",
72+
"-Wclippy::useless_transmute",
73+
"-Wclippy::verbose_file_reads",
74+
"-Wclippy::zero_sized_map_values",
75+
"-Wfuture_incompatible",
76+
"-Wnonstandard_style",
77+
"-Wrust_2018_idioms",
78+
# END - Embark standard lints v6 for Rust 1.55+
79+
]

src/lib.rs

+8-61
Original file line numberDiff line numberDiff line change
@@ -27,59 +27,6 @@
2727
//!
2828
//! - `enable` - this flag is used by default and enables calling the Superluminal Performance API. This can be useful to only enable the events only for specific application features
2929
30-
// BEGIN - Embark standard lints v0.3
31-
// do not change or add/remove here, but one can add exceptions after this section
32-
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
33-
#![deny(unsafe_code)]
34-
#![warn(
35-
clippy::all,
36-
clippy::await_holding_lock,
37-
clippy::dbg_macro,
38-
clippy::debug_assert_with_mut_call,
39-
clippy::doc_markdown,
40-
clippy::empty_enum,
41-
clippy::enum_glob_use,
42-
clippy::exit,
43-
clippy::explicit_into_iter_loop,
44-
clippy::filter_map_next,
45-
clippy::fn_params_excessive_bools,
46-
clippy::if_let_mutex,
47-
clippy::imprecise_flops,
48-
clippy::inefficient_to_string,
49-
clippy::large_types_passed_by_value,
50-
clippy::let_unit_value,
51-
clippy::linkedlist,
52-
clippy::lossy_float_literal,
53-
clippy::macro_use_imports,
54-
clippy::map_err_ignore,
55-
clippy::map_flatten,
56-
clippy::map_unwrap_or,
57-
clippy::match_on_vec_items,
58-
clippy::match_same_arms,
59-
clippy::match_wildcard_for_single_variants,
60-
clippy::mem_forget,
61-
clippy::mismatched_target_os,
62-
clippy::needless_borrow,
63-
clippy::needless_continue,
64-
clippy::option_option,
65-
clippy::pub_enum_variant_names,
66-
clippy::ref_option_ref,
67-
clippy::rest_pat_in_fully_bound_structs,
68-
clippy::string_add_assign,
69-
clippy::string_add,
70-
clippy::string_to_string,
71-
clippy::suboptimal_flops,
72-
clippy::todo,
73-
clippy::unimplemented,
74-
clippy::unnested_or_patterns,
75-
clippy::unused_self,
76-
clippy::verbose_file_reads,
77-
future_incompatible,
78-
nonstandard_style,
79-
rust_2018_idioms
80-
)]
81-
// END - Embark standard lints v0.3
82-
// crate-specific exceptions:
8330
#![allow(unused_variables)]
8431
#![allow(unsafe_code)]
8532

@@ -99,12 +46,12 @@ pub fn begin_event(id: &str) {
9946
#[cfg(all(feature = "enable", target_os = "windows"))]
10047
unsafe {
10148
ffi::PerformanceAPI_BeginEvent_N(
102-
id.as_ptr() as *const i8,
49+
id.as_ptr().cast::<i8>(),
10350
id.len() as u16,
10451
std::ptr::null(),
10552
0,
10653
ffi::DEFAULT_COLOR,
107-
)
54+
);
10855
}
10956
}
11057

@@ -113,12 +60,12 @@ pub fn begin_event_with_color(id: &str, color: u32) {
11360
#[cfg(all(feature = "enable", target_os = "windows"))]
11461
unsafe {
11562
ffi::PerformanceAPI_BeginEvent_N(
116-
id.as_ptr() as *const i8,
63+
id.as_ptr().cast::<i8>(),
11764
id.len() as u16,
11865
std::ptr::null(),
11966
0,
12067
color,
121-
)
68+
);
12269
}
12370
}
12471

@@ -129,12 +76,12 @@ pub fn begin_event_with_data(id: &str, data: &str, color: u32) {
12976
#[cfg(all(feature = "enable", target_os = "windows"))]
13077
unsafe {
13178
ffi::PerformanceAPI_BeginEvent_N(
132-
id.as_ptr() as *const i8,
79+
id.as_ptr().cast::<i8>(),
13380
id.len() as u16,
134-
data.as_ptr() as *const i8,
81+
data.as_ptr().cast::<i8>(),
13582
data.len() as u16,
13683
color,
137-
)
84+
);
13885
}
13986
}
14087

@@ -154,6 +101,6 @@ pub fn end_event() {
154101
pub fn set_current_thread_name(name: &str) {
155102
#[cfg(all(feature = "enable", target_os = "windows"))]
156103
unsafe {
157-
ffi::PerformanceAPI_SetCurrentThreadName_N(name.as_ptr() as *const i8, name.len() as u16)
104+
ffi::PerformanceAPI_SetCurrentThreadName_N(name.as_ptr().cast::<i8>(), name.len() as u16);
158105
}
159106
}

sys/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ fn main() {
1414
"cargo:rustc-link-search={}/external/lib/x64/",
1515
std::env!("CARGO_MANIFEST_DIR")
1616
);
17-
println!("cargo:rustc-link-lib=PerformanceAPI_{}", runtime())
17+
println!("cargo:rustc-link-lib=PerformanceAPI_{}", runtime());
1818
}

sys/src/lib.rs

-55
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,3 @@
1-
// BEGIN - Embark standard lints v0.3
2-
// do not change or add/remove here, but one can add exceptions after this section
3-
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
4-
#![deny(unsafe_code)]
5-
#![warn(
6-
clippy::all,
7-
clippy::await_holding_lock,
8-
clippy::dbg_macro,
9-
clippy::debug_assert_with_mut_call,
10-
clippy::doc_markdown,
11-
clippy::empty_enum,
12-
clippy::enum_glob_use,
13-
clippy::exit,
14-
clippy::explicit_into_iter_loop,
15-
clippy::filter_map_next,
16-
clippy::fn_params_excessive_bools,
17-
clippy::if_let_mutex,
18-
clippy::imprecise_flops,
19-
clippy::inefficient_to_string,
20-
clippy::large_types_passed_by_value,
21-
clippy::let_unit_value,
22-
clippy::linkedlist,
23-
clippy::lossy_float_literal,
24-
clippy::macro_use_imports,
25-
clippy::map_err_ignore,
26-
clippy::map_flatten,
27-
clippy::map_unwrap_or,
28-
clippy::match_on_vec_items,
29-
clippy::match_same_arms,
30-
clippy::match_wildcard_for_single_variants,
31-
clippy::mem_forget,
32-
clippy::mismatched_target_os,
33-
clippy::needless_borrow,
34-
clippy::needless_continue,
35-
clippy::option_option,
36-
clippy::pub_enum_variant_names,
37-
clippy::ref_option_ref,
38-
clippy::rest_pat_in_fully_bound_structs,
39-
clippy::string_add_assign,
40-
clippy::string_add,
41-
clippy::string_to_string,
42-
clippy::suboptimal_flops,
43-
clippy::todo,
44-
clippy::unimplemented,
45-
clippy::unnested_or_patterns,
46-
clippy::unused_self,
47-
clippy::verbose_file_reads,
48-
future_incompatible,
49-
nonstandard_style,
50-
rust_2018_idioms
51-
)]
52-
// END - Embark standard lints v0.3
53-
// crate-specific exceptions:
54-
#![allow()]
55-
561
use std::os::raw::c_char;
572

583
pub const DEFAULT_COLOR: u32 = 0xFF_FF_FF_FF;

0 commit comments

Comments
 (0)