Skip to content

Commit fd400ca

Browse files
Firestar99LegNeato
authored andcommitted
ci: fix newer clippy lints
1 parent 11df631 commit fd400ca

File tree

10 files changed

+111
-112
lines changed

10 files changed

+111
-112
lines changed

.cargo/config.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ rustflags = [
4545
"-Wclippy::match_wild_err_arm",
4646
"-Wclippy::match_wildcard_for_single_variants",
4747
"-Wclippy::mem_forget",
48-
"-Wclippy::mismatched_target_os",
4948
"-Wclippy::missing_enforced_import_renames",
5049
"-Wclippy::mut_mut",
5150
"-Wclippy::mutex_integer",

spirv-tools-sys/src/assembler.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum DisassembleOptions {
2525
NoHeader = 0x20,
2626
/// Use friendly names where possible. The heuristic may expand over
2727
/// time, but will use common names for scalar types, and debug names from
28-
/// OpName instructions.
28+
/// `OpName` instructions.
2929
FriendlyNames = 0x40,
3030
/// Add some comments to the generated assembly
3131
Comment = 0x80,
@@ -41,7 +41,7 @@ extern "C" {
4141
/// by the context's target environment.
4242
///
4343
/// The options parameter is a bit field of
44-
/// spv_text_to_binary_options_t.
44+
/// `spv_text_to_binary_options_t`.
4545
#[link_name = "spvTextToBinaryWithOptions"]
4646
pub fn assemble(
4747
tool: *const shared::ToolContext,
@@ -53,8 +53,8 @@ extern "C" {
5353
) -> shared::SpirvResult;
5454

5555
/// Decodes the given SPIR-V binary representation to its assembly text. The
56-
/// word_count parameter specifies the number of words for binary. The options
57-
/// parameter is a bit field of spv_binary_to_text_options_t. Decoded text will
56+
/// `word_count` parameter specifies the number of words for binary. The options
57+
/// parameter is a bit field of `spv_binary_to_text_options_t`. Decoded text will
5858
/// be stored into *text. Any error will be written into *diagnostic if
5959
/// diagnostic is non-null, otherwise the context's message consumer will be
6060
/// used.

spirv-tools-sys/src/opt.rs

Lines changed: 73 additions & 73 deletions
Large diffs are not rendered by default.

spirv-tools-sys/src/shared.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@ pub enum TargetEnv {
2626
Vulkan_1_0,
2727
/// SPIR-V 1.1 latest revision, no other restrictions.
2828
Universal_1_1,
29-
/// OpenCL Full Profile 2.1 latest revision.
29+
/// `OpenCL` Full Profile 2.1 latest revision.
3030
OpenCL_2_1,
31-
/// OpenCL Full Profile 2.2 latest revision.
31+
/// `OpenCL` Full Profile 2.2 latest revision.
3232
OpenCL_2_2,
33-
/// OpenGL 4.0 plus GL_ARB_gl_spirv, latest revisions.
33+
/// OpenGL 4.0 plus `GL_ARB_gl_spirv`, latest revisions.
3434
OpenGL_4_0,
35-
/// OpenGL 4.1 plus GL_ARB_gl_spirv, latest revisions.
35+
/// OpenGL 4.1 plus `GL_ARB_gl_spirv`, latest revisions.
3636
OpenGL_4_1,
37-
/// OpenGL 4.2 plus GL_ARB_gl_spirv, latest revisions.
37+
/// OpenGL 4.2 plus `GL_ARB_gl_spirv`, latest revisions.
3838
OpenGL_4_2,
39-
/// OpenGL 4.3 plus GL_ARB_gl_spirv, latest revisions.
39+
/// OpenGL 4.3 plus `GL_ARB_gl_spirv`, latest revisions.
4040
OpenGL_4_3,
41-
/// OpenGL 4.5 plus GL_ARB_gl_spirv, latest revisions.
41+
/// OpenGL 4.5 plus `GL_ARB_gl_spirv`, latest revisions.
4242
OpenGL_4_5,
4343
/// SPIR-V 1.2, latest revision, no other restrictions.
4444
Universal_1_2,
45-
/// OpenCL Full Profile 1.2 plus cl_khr_il_program, latest revision.
45+
/// `OpenCL` Full Profile 1.2 plus `cl_khr_il_program`, latest revision.
4646
OpenCL_1_2,
47-
/// OpenCL Embedded Profile 1.2 plus cl_khr_il_program, latest revision.
47+
/// `OpenCL` Embedded Profile 1.2 plus `cl_khr_il_program`, latest revision.
4848
OpenCLEmbedded_1_2,
49-
/// OpenCL Full Profile 2.0 plus cl_khr_il_program, latest revision.
49+
/// `OpenCL` Full Profile 2.0 plus `cl_khr_il_program`, latest revision.
5050
OpenCL_2_0,
51-
/// OpenCL Embedded Profile 2.0 plus cl_khr_il_program, latest revision.
51+
/// `OpenCL` Embedded Profile 2.0 plus `cl_khr_il_program`, latest revision.
5252
OpenCLEmbedded_2_0,
53-
/// OpenCL Embedded Profile 2.1 latest revision.
53+
/// `OpenCL` Embedded Profile 2.1 latest revision.
5454
OpenCLEmbedded_2_1,
55-
/// OpenCL Embedded Profile 2.2 latest revision.
55+
/// `OpenCL` Embedded Profile 2.2 latest revision.
5656
OpenCLEmbedded_2_2,
5757
/// SPIR-V 1.3 latest revision, no other restrictions.
5858
Universal_1_3,
@@ -62,7 +62,7 @@ pub enum TargetEnv {
6262
WebGPU_0,
6363
/// SPIR-V 1.4 latest revision, no other restrictions.
6464
Universal_1_4,
65-
/// Vulkan 1.1 with VK_KHR_spirv_1_4, i.e. SPIR-V 1.4 binary.
65+
/// Vulkan 1.1 with `VK_KHR_spirv_1_4`, i.e. SPIR-V 1.4 binary.
6666
Vulkan_1_1_Spirv_1_4,
6767
/// SPIR-V 1.5 latest revision, no other restrictions.
6868
Universal_1_5,

spirv-tools-sys/src/val.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ extern "C" {
7878
/// if
7979
///
8080
/// 1) the members of the structs are either the same type or are structs with
81-
/// same layout, and
81+
/// same layout, and
8282
///
8383
/// 2) the decorations that affect the memory layout are identical for both
84-
/// types. Other decorations are not relevant.
84+
/// types. Other decorations are not relevant.
8585
#[link_name = "spvValidatorOptionsSetRelaxStoreStruct"]
8686
pub fn validator_options_set_relax_store_struct(opts: *mut ValidatorOptions, toggle: bool);
8787

8888
/// Records whether or not the validator should relax the rules on pointer usage
8989
/// in logical addressing mode.
9090
///
9191
/// When relaxed, it will allow the following usage cases of pointers:
92-
/// 1) OpVariable allocating an object whose type is a pointer type
93-
/// 2) OpReturnValue returning a pointer value
92+
/// 1) `OpVariable` allocating an object whose type is a pointer type
93+
/// 2) `OpReturnValue` returning a pointer value
9494
#[link_name = "spvValidatorOptionsSetRelaxLogicalPointer"]
9595
pub fn validator_options_set_relax_logical_pointer(opts: *mut ValidatorOptions, toggle: bool);
9696

@@ -110,7 +110,7 @@ extern "C" {
110110

111111
/// Records whether the validator should use "relaxed" block layout rules.
112112
/// Relaxed layout rules are described by Vulkan extension
113-
/// VK_KHR_relaxed_block_layout, and they affect uniform blocks, storage blocks,
113+
/// `VK_KHR_relaxed_block_layout`, and they affect uniform blocks, storage blocks,
114114
/// and push constants.
115115
///
116116
/// This is enabled by default when targeting Vulkan 1.1 or later.
@@ -129,7 +129,7 @@ extern "C" {
129129
/// Records whether the validator should use "scalar" block layout rules.
130130
/// Scalar layout rules are more permissive than relaxed block layout.
131131
///
132-
/// See Vulkan extnesion VK_EXT_scalar_block_layout. The scalar alignment is
132+
/// See Vulkan extnesion `VK_EXT_scalar_block_layout`. The scalar alignment is
133133
/// defined as follows:
134134
/// - scalar alignment of a scalar is the scalar size
135135
/// - scalar alignment of a vector is the scalar alignment of its component
@@ -138,9 +138,9 @@ extern "C" {
138138
/// - scalar alignment of a struct is the max scalar alignment among its
139139
/// members
140140
///
141-
/// For a struct in Uniform, StorageClass, or PushConstant:
141+
/// For a struct in Uniform, `StorageClass`, or `PushConstant`:
142142
/// - a member Offset must be a multiple of the member's scalar alignment
143-
/// - ArrayStride or MatrixStride must be a multiple of the array or matrix
143+
/// - `ArrayStride` or `MatrixStride` must be a multiple of the array or matrix
144144
/// scalar alignment
145145
#[link_name = "spvValidatorOptionsSetScalarBlockLayout"]
146146
pub fn validator_options_set_scalar_block_layout(opts: *mut ValidatorOptions, toggle: bool);

src/assembler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct DisassembleOptions {
4040
pub no_header: bool,
4141
/// Use friendly names where possible. The heuristic may expand over
4242
/// time, but will use common names for scalar types, and debug names from
43-
/// OpName instructions.
43+
/// `OpName` instructions.
4444
pub use_friendly_names: bool,
4545
/// Add some comments to the generated assembly
4646
pub comment: bool,

src/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl From<CmdError> for crate::error::Error {
3737
} => {
3838
// The C API just puts the last message as the diagnostic, so just do the
3939
// same for now
40-
let diagnostic = messages.into_iter().last().map_or_else(
40+
let diagnostic = messages.into_iter().next_back().map_or_else(
4141
|| {
4242
crate::error::Diagnostic::from(format!(
4343
"tool exited with code `{exit_code}` and no output"

src/val.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ pub struct ValidatorOptions {
1313
/// if
1414
///
1515
/// 1) the members of the structs are either the same type or are structs with
16-
/// same layout, and
16+
/// same layout, and
1717
///
1818
/// 2) the decorations that affect the memory layout are identical for both
19-
/// types. Other decorations are not relevant.
19+
/// types. Other decorations are not relevant.
2020
pub relax_struct_store: bool,
2121
/// Records whether or not the validator should relax the rules on pointer usage
2222
/// in logical addressing mode.
2323
///
2424
/// When relaxed, it will allow the following usage cases of pointers:
25-
/// 1) OpVariable allocating an object whose type is a pointer type
26-
/// 2) OpReturnValue returning a pointer value
25+
/// 1) `OpVariable` allocating an object whose type is a pointer type
26+
/// 2) `OpReturnValue` returning a pointer value
2727
pub relax_logical_pointer: bool,
2828
/// Records whether or not the validator should relax the rules because it is
2929
/// expected that the optimizations will make the code legal.
@@ -39,7 +39,7 @@ pub struct ValidatorOptions {
3939
pub before_legalization: bool,
4040
/// Records whether the validator should use "relaxed" block layout rules.
4141
/// Relaxed layout rules are described by Vulkan extension
42-
/// VK_KHR_relaxed_block_layout, and they affect uniform blocks, storage blocks,
42+
/// `VK_KHR_relaxed_block_layout`, and they affect uniform blocks, storage blocks,
4343
/// and push constants.
4444
///
4545
/// This is enabled by default when targeting Vulkan 1.1 or later.
@@ -51,7 +51,7 @@ pub struct ValidatorOptions {
5151
/// Records whether the validator should use "scalar" block layout rules.
5252
/// Scalar layout rules are more permissive than relaxed block layout.
5353
///
54-
/// See Vulkan extnesion VK_EXT_scalar_block_layout. The scalar alignment is
54+
/// See Vulkan extnesion `VK_EXT_scalar_block_layout`. The scalar alignment is
5555
/// defined as follows:
5656
/// - scalar alignment of a scalar is the scalar size
5757
/// - scalar alignment of a vector is the scalar alignment of its component
@@ -60,9 +60,9 @@ pub struct ValidatorOptions {
6060
/// - scalar alignment of a struct is the max scalar alignment among its
6161
/// members
6262
///
63-
/// For a struct in Uniform, StorageClass, or PushConstant:
63+
/// For a struct in Uniform, `StorageClass`, or `PushConstant`:
6464
/// - a member Offset must be a multiple of the member's scalar alignment
65-
/// - ArrayStride or MatrixStride must be a multiple of the array or matrix
65+
/// - `ArrayStride` or `MatrixStride` must be a multiple of the array or matrix
6666
/// scalar alignment
6767
pub scalar_block_layout: bool,
6868
/// Records whether or not the validator should skip validating standard

tools/install/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn main() {
9090
let _s = Group::new(&format!("adding '{td}' to $GITHUB_PATH ({gh_path:?})"));
9191

9292
// emulate >> for both empty and non-empty files
93-
let has_contents = fs::metadata(&gh_path).map_or(false, |md| md.len() > 0);
93+
let has_contents = fs::metadata(&gh_path).is_ok_and(|md| md.len() > 0);
9494

9595
let mut file = fs::OpenOptions::new()
9696
.append(true)

tools/package/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn main() {
9595
};
9696

9797
let name = if ext.is_empty() {
98-
exe.to_string()
98+
(*exe).to_string()
9999
} else {
100100
format!("{exe}.{ext}")
101101
};

0 commit comments

Comments
 (0)