Skip to content

Commit

Permalink
1.83 clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed Jan 6, 2025
1 parent 96500c5 commit 1876583
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/compose/comment_strip_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ impl<'a> Iterator for CommentReplaceIter<'a> {

pub trait CommentReplaceExt<'a> {
/// replace WGSL and GLSL comments with whitespace characters
fn replace_comments(&'a mut self) -> CommentReplaceIter;
fn replace_comments(&'a mut self) -> CommentReplaceIter<'a>;
}

impl<'a> CommentReplaceExt<'a> for Lines<'a> {
fn replace_comments(&'a mut self) -> CommentReplaceIter {
fn replace_comments(&'a mut self) -> CommentReplaceIter<'a> {
CommentReplaceIter {
lines: self,
state: CommentState::None,
Expand Down
2 changes: 1 addition & 1 deletion src/compose/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl Composer {
auto: &'a mut u32,
}

impl<'a> regex::Replacer for AutoBindingReplacer<'a> {
impl regex::Replacer for AutoBindingReplacer<'_> {
fn replace_append(&mut self, _: &regex::Captures<'_>, dst: &mut String) {
dst.push_str(&format!("@binding({})", self.auto));
*self.auto += 1;
Expand Down
26 changes: 13 additions & 13 deletions src/compose/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,9 @@ defined
let PreprocessorMetaData {
defines: shader_defs,
..
} = processor.get_preprocessor_metadata(&WGSL, true).unwrap();
} = processor.get_preprocessor_metadata(WGSL, true).unwrap();
println!("defines: {:?}", shader_defs);
let result = processor.preprocess(&WGSL, &shader_defs).unwrap();
let result = processor.preprocess(WGSL, &shader_defs).unwrap();
assert_eq!(result.preprocessed_source, EXPECTED);
}

Expand Down Expand Up @@ -1079,9 +1079,9 @@ bool: false
let PreprocessorMetaData {
defines: shader_defs,
..
} = processor.get_preprocessor_metadata(&WGSL, true).unwrap();
} = processor.get_preprocessor_metadata(WGSL, true).unwrap();
println!("defines: {:?}", shader_defs);
let result = processor.preprocess(&WGSL, &shader_defs).unwrap();
let result = processor.preprocess(WGSL, &shader_defs).unwrap();
assert_eq!(result.preprocessed_source, EXPECTED);
}

Expand Down Expand Up @@ -1113,7 +1113,7 @@ fn vertex(
}
";
let processor = Preprocessor::default();
let result = processor.preprocess(&WGSL_ELSE_IFDEF, &[].into()).unwrap();
let result = processor.preprocess(WGSL_ELSE_IFDEF, &[].into()).unwrap();
assert_eq!(
result
.preprocessed_source
Expand Down Expand Up @@ -1190,7 +1190,7 @@ fn vertex(
";
let processor = Preprocessor::default();
let result = processor
.preprocess(&WGSL_ELSE_IFDEF_NO_ELSE_FALLBACK, &[].into())
.preprocess(WGSL_ELSE_IFDEF_NO_ELSE_FALLBACK, &[].into())
.unwrap();
assert_eq!(
result
Expand Down Expand Up @@ -1239,7 +1239,7 @@ fn vertex(
let processor = Preprocessor::default();
let result = processor
.preprocess(
&WGSL_ELSE_IFDEF,
WGSL_ELSE_IFDEF,
&[("TEXTURE".to_string(), ShaderDefValue::Bool(true))].into(),
)
.unwrap();
Expand Down Expand Up @@ -1287,7 +1287,7 @@ fn vertex(
let processor = Preprocessor::default();
let result = processor
.preprocess(
&WGSL_ELSE_IFDEF,
WGSL_ELSE_IFDEF,
&[("SECOND_TEXTURE".to_string(), ShaderDefValue::Bool(true))].into(),
)
.unwrap();
Expand Down Expand Up @@ -1335,7 +1335,7 @@ fn vertex(
let processor = Preprocessor::default();
let result = processor
.preprocess(
&WGSL_ELSE_IFDEF,
WGSL_ELSE_IFDEF,
&[("THIRD_TEXTURE".to_string(), ShaderDefValue::Bool(true))].into(),
)
.unwrap();
Expand Down Expand Up @@ -1383,7 +1383,7 @@ fn vertex(
let processor = Preprocessor::default();
let result = processor
.preprocess(
&WGSL_ELSE_IFDEF,
WGSL_ELSE_IFDEF,
&[
("SECOND_TEXTURE".to_string(), ShaderDefValue::Bool(true)),
("THIRD_TEXTURE".to_string(), ShaderDefValue::Bool(true)),
Expand Down Expand Up @@ -1441,7 +1441,7 @@ fn vertex(
let processor = Preprocessor::default();
let result = processor
.preprocess(
&WGSL_COMPLICATED_ELSE_IFDEF,
WGSL_COMPLICATED_ELSE_IFDEF,
&[("IS_DEFINED".to_string(), ShaderDefValue::Bool(true))].into(),
)
.unwrap();
Expand Down Expand Up @@ -1475,7 +1475,7 @@ fail 3

const EXPECTED: &str = r"ok";
let processor = Preprocessor::default();
let result = processor.preprocess(&INPUT, &[].into()).unwrap();
let result = processor.preprocess(INPUT, &[].into()).unwrap();
assert_eq!(
result
.preprocessed_source
Expand Down Expand Up @@ -1507,7 +1507,7 @@ fail 3
const EXPECTED: &str = r"ok";
let processor = Preprocessor::default();
let result = processor
.preprocess(&INPUT, &[("x".to_owned(), ShaderDefValue::Int(2))].into())
.preprocess(INPUT, &[("x".to_owned(), ShaderDefValue::Int(2))].into())
.unwrap();
assert_eq!(
result
Expand Down
2 changes: 1 addition & 1 deletion src/compose/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum Token<'a> {
Whitespace(&'a str, usize),
}

impl<'a> Token<'a> {
impl Token<'_> {
pub fn pos(&self) -> usize {
match self {
Token::Identifier(_, pos) | Token::Other(_, pos) | Token::Whitespace(_, pos) => *pos,
Expand Down
2 changes: 1 addition & 1 deletion src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ impl<'a> DerivedModule<'a> {
}
}

impl<'a> From<DerivedModule<'a>> for naga::Module {
impl From<DerivedModule<'_>> for naga::Module {
fn from(derived: DerivedModule) -> Self {
naga::Module {
types: derived.types,
Expand Down

0 comments on commit 1876583

Please sign in to comment.