Skip to content

Commit a990ed5

Browse files
authored
Use Embark standard lints v0.2 (#475)
1 parent d37b41c commit a990ed5

File tree

13 files changed

+317
-55
lines changed

13 files changed

+317
-55
lines changed

crates/rustc_codegen_spirv/src/decorations.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
//! SPIR-V decorations specific to `rustc_codegen_spirv`, produced during
22
//! the original codegen of a crate, and consumed by the `linker`.
33
4-
// FIXME(eddyb) Remove when a fix for clippy warning in `serde` derives
5-
// (https://github.com/rust-lang/rust-clippy/issues/6818) lands in nightly.
6-
#![allow(clippy::use_self)]
7-
84
use rspirv::dr::{Instruction, Module, Operand};
95
use rspirv::spirv::{Decoration, Op, Word};
106
use rustc_span::{source_map::SourceMap, FileName, Pos, Span};

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,61 @@
1717
//! [`spirv-tools-sys`]: https://embarkstudios.github.io/rust-gpu/api/spirv_tools_sys
1818
#![feature(rustc_private)]
1919
#![feature(once_cell)]
20-
#![deny(clippy::unimplemented, clippy::ok_expect, clippy::mem_forget)]
21-
// Our standard Clippy lints that we use in Embark projects, we opt out of a few that are not appropriate for the specific crate (yet)
20+
// BEGIN - Embark standard lints v0.2.
21+
// do not change or add/remove here, but one can add exceptions after this section
22+
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
23+
#![deny(unsafe_code)]
2224
#![warn(
2325
clippy::all,
24-
clippy::doc_markdown,
26+
clippy::await_holding_lock,
2527
clippy::dbg_macro,
26-
//clippy::todo,
28+
clippy::debug_assert_with_mut_call,
29+
clippy::doc_markdown,
2730
clippy::empty_enum,
28-
//clippy::enum_glob_use,
29-
clippy::pub_enum_variant_names,
30-
clippy::mem_forget,
31-
clippy::use_self,
31+
clippy::enum_glob_use,
32+
clippy::exit,
33+
clippy::explicit_into_iter_loop,
3234
clippy::filter_map_next,
33-
clippy::needless_continue,
34-
clippy::needless_borrow,
35-
clippy::match_wildcard_for_single_variants,
35+
clippy::fn_params_excessive_bools,
3636
clippy::if_let_mutex,
37-
clippy::mismatched_target_os,
38-
clippy::await_holding_lock,
39-
//clippy::match_on_vec_items,
4037
clippy::imprecise_flops,
41-
clippy::suboptimal_flops,
42-
clippy::lossy_float_literal,
43-
clippy::rest_pat_in_fully_bound_structs,
44-
clippy::fn_params_excessive_bools,
45-
clippy::exit,
4638
clippy::inefficient_to_string,
39+
clippy::let_unit_value,
4740
clippy::linkedlist,
41+
clippy::lossy_float_literal,
4842
clippy::macro_use_imports,
43+
clippy::map_flatten,
44+
clippy::map_unwrap_or,
45+
clippy::match_on_vec_items,
46+
clippy::match_wildcard_for_single_variants,
47+
clippy::mem_forget,
48+
clippy::mismatched_target_os,
49+
clippy::needless_borrow,
50+
clippy::needless_continue,
4951
clippy::option_option,
50-
clippy::verbose_file_reads,
52+
clippy::pub_enum_variant_names,
53+
clippy::ref_option_ref,
54+
clippy::rest_pat_in_fully_bound_structs,
55+
clippy::string_to_string,
56+
clippy::suboptimal_flops,
57+
clippy::todo,
5158
clippy::unnested_or_patterns,
52-
rust_2018_idioms,
59+
clippy::unused_self,
60+
clippy::verbose_file_reads,
5361
future_incompatible,
54-
nonstandard_style
62+
nonstandard_style,
63+
rust_2018_idioms
64+
)]
65+
// END - Embark standard lints v0.2
66+
// crate-specific exceptions:
67+
#![allow(
68+
unsafe_code, // still quite a bit of unsafe
69+
clippy::map_unwrap_or, // TODO: test enabling
70+
clippy::match_on_vec_items, // TODO: test enabling
71+
clippy::enum_glob_use,
72+
clippy::todo, // still lots to implement :)
5573
)]
74+
#![deny(clippy::unimplemented, clippy::ok_expect)]
5675

5776
extern crate rustc_ast;
5877
extern crate rustc_attr;

crates/rustc_codegen_spirv/src/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ pub(crate) fn run_thin(
465465
let mut thin_buffers = Vec::with_capacity(modules.len());
466466
let mut module_names = Vec::with_capacity(modules.len() + cached_modules.len());
467467

468-
for (name, buffer) in modules.into_iter() {
468+
for (name, buffer) in modules {
469469
let cname = CString::new(name.clone()).unwrap();
470470
thin_buffers.push(buffer);
471471
module_names.push(cname);

crates/rustc_codegen_spirv/src/linker/specializer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ struct Unapplicable;
12611261

12621262
impl<'a, S: Specialization> InferCx<'a, S> {
12631263
/// Match `storage_class` against `pat`, returning a `Match` with found `Var`s.
1264+
#[allow(clippy::unused_self)] // TODO: remove?
12641265
fn match_storage_class_pat(
12651266
&self,
12661267
pat: &StorageClassPat,

crates/spirv-builder/src/lib.rs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
1+
// BEGIN - Embark standard lints v0.2.
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::let_unit_value,
21+
clippy::linkedlist,
22+
clippy::lossy_float_literal,
23+
clippy::macro_use_imports,
24+
clippy::map_flatten,
25+
clippy::map_unwrap_or,
26+
clippy::match_on_vec_items,
27+
clippy::match_wildcard_for_single_variants,
28+
clippy::mem_forget,
29+
clippy::mismatched_target_os,
30+
clippy::needless_borrow,
31+
clippy::needless_continue,
32+
clippy::option_option,
33+
clippy::pub_enum_variant_names,
34+
clippy::ref_option_ref,
35+
clippy::rest_pat_in_fully_bound_structs,
36+
clippy::string_to_string,
37+
clippy::suboptimal_flops,
38+
clippy::todo,
39+
clippy::unnested_or_patterns,
40+
clippy::unused_self,
41+
clippy::verbose_file_reads,
42+
future_incompatible,
43+
nonstandard_style,
44+
rust_2018_idioms
45+
)]
46+
// END - Embark standard lints v0.2
47+
// crate-specific exceptions:
48+
#![allow()]
49+
150
#[cfg(test)]
251
mod test;
352

@@ -75,7 +124,7 @@ impl SpirvBuilder {
75124
self
76125
}
77126

78-
/// Builds the module. Returns the path to the built spir-v file. If print_metadata is true,
127+
/// Builds the module. Returns the path to the built spir-v file. If `print_metadata` is true,
79128
/// you usually don't have to inspect the path, as the environment variable will already be
80129
/// set.
81130
pub fn build(self) -> Result<PathBuf, SpirvBuilderError> {

crates/spirv-std-macros/src/lib.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
1+
// BEGIN - Embark standard lints v0.2.
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::let_unit_value,
21+
clippy::linkedlist,
22+
clippy::lossy_float_literal,
23+
clippy::macro_use_imports,
24+
clippy::map_flatten,
25+
clippy::map_unwrap_or,
26+
clippy::match_on_vec_items,
27+
clippy::match_wildcard_for_single_variants,
28+
clippy::mem_forget,
29+
clippy::mismatched_target_os,
30+
clippy::needless_borrow,
31+
clippy::needless_continue,
32+
clippy::option_option,
33+
clippy::pub_enum_variant_names,
34+
clippy::ref_option_ref,
35+
clippy::rest_pat_in_fully_bound_structs,
36+
clippy::string_to_string,
37+
clippy::suboptimal_flops,
38+
clippy::todo,
39+
clippy::unnested_or_patterns,
40+
clippy::unused_self,
41+
clippy::verbose_file_reads,
42+
future_incompatible,
43+
nonstandard_style,
44+
rust_2018_idioms
45+
)]
46+
// END - Embark standard lints v0.2
47+
// crate-specific exceptions:
48+
#![allow()]
49+
150
use proc_macro::{Delimiter, Group, TokenStream, TokenTree};
251

352
#[proc_macro_attribute]

crates/spirv-std/src/lib.rs

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,54 @@
44
feature(asm, register_attr, repr_simd, core_intrinsics, lang_items),
55
register_attr(spirv)
66
)]
7-
// Our standard Clippy lints that we use in Embark projects, we opt out of a few that are not appropriate for the specific crate (yet)
7+
// BEGIN - Embark standard lints v0.2.
8+
// do not change or add/remove here, but one can add exceptions after this section
9+
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
10+
#![deny(unsafe_code)]
811
#![warn(
912
clippy::all,
10-
clippy::doc_markdown,
13+
clippy::await_holding_lock,
1114
clippy::dbg_macro,
12-
clippy::todo,
15+
clippy::debug_assert_with_mut_call,
16+
clippy::doc_markdown,
1317
clippy::empty_enum,
1418
clippy::enum_glob_use,
15-
clippy::pub_enum_variant_names,
16-
clippy::mem_forget,
19+
clippy::exit,
20+
clippy::explicit_into_iter_loop,
1721
clippy::filter_map_next,
18-
clippy::needless_continue,
19-
clippy::needless_borrow,
20-
clippy::match_wildcard_for_single_variants,
22+
clippy::fn_params_excessive_bools,
2123
clippy::if_let_mutex,
22-
clippy::mismatched_target_os,
23-
clippy::await_holding_lock,
24-
clippy::match_on_vec_items,
2524
clippy::imprecise_flops,
26-
//clippy::suboptimal_flops,
27-
clippy::lossy_float_literal,
28-
clippy::rest_pat_in_fully_bound_structs,
29-
clippy::fn_params_excessive_bools,
30-
clippy::exit,
3125
clippy::inefficient_to_string,
26+
clippy::let_unit_value,
3227
clippy::linkedlist,
28+
clippy::lossy_float_literal,
3329
clippy::macro_use_imports,
30+
clippy::map_flatten,
31+
clippy::map_unwrap_or,
32+
clippy::match_on_vec_items,
33+
clippy::match_wildcard_for_single_variants,
34+
clippy::mem_forget,
35+
clippy::mismatched_target_os,
36+
clippy::needless_borrow,
37+
clippy::needless_continue,
3438
clippy::option_option,
35-
clippy::verbose_file_reads,
39+
clippy::pub_enum_variant_names,
40+
clippy::ref_option_ref,
41+
clippy::rest_pat_in_fully_bound_structs,
42+
clippy::string_to_string,
43+
clippy::suboptimal_flops,
44+
clippy::todo,
3645
clippy::unnested_or_patterns,
37-
rust_2018_idioms,
46+
clippy::unused_self,
47+
clippy::verbose_file_reads,
3848
future_incompatible,
39-
nonstandard_style
49+
nonstandard_style,
50+
rust_2018_idioms
4051
)]
52+
// END - Embark standard lints v0.2
53+
// crate-specific exceptions:
54+
#![allow(unsafe_code)] // still quite a bit needed
4155

4256
#[cfg(not(target_arch = "spirv"))]
4357
#[macro_use]

crates/spirv-tools-sys/spirv-headers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 7845730cab6ebbdeb621e7349b7dc1a59c3377be

crates/spirv-tools-sys/spirv-tools

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 36494dd966ecaa4a399f3f7755bbdcf561229503

0 commit comments

Comments
 (0)