Skip to content

Commit 5de3752

Browse files
committed
fix clippy from my changes
1 parent 768d7b6 commit 5de3752

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

naga/src/compact/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub fn compact(module: &mut crate::Module) {
277277
} = **comments;
278278
log::trace!("adjusting comments for types");
279279
for (mut comment_type_handle, comment) in std::mem::take(comment_types) {
280-
if !module_map.types.used(comment_type_handle.clone()) {
280+
if !module_map.types.used(comment_type_handle) {
281281
continue;
282282
}
283283
module_map.types.adjust(&mut comment_type_handle);

naga/src/front/wgsl/parse/lexer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn consume_token(input: &str, generic: bool, save_comments: bool) -> (Token<'_>,
112112
// Skip '/' and '*'
113113
char_indices.next();
114114
char_indices.next();
115-
while let Some((index, c)) = char_indices.next() {
115+
for (index, c) in char_indices {
116116
match (prev, c) {
117117
(Some('*'), '/') => {
118118
prev = None;

naga/src/front/wgsl/parse/mod.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ impl Parser {
12461246
binding,
12471247
size: size.value,
12481248
align: align.value,
1249-
comments: comments,
1249+
comments,
12501250
});
12511251

12521252
if !member_names.insert(name.name) {
@@ -2860,16 +2860,9 @@ impl Parser {
28602860
let token = cloned.next_until(|_| true, false);
28612861
token
28622862
}
2863-
loop {
2864-
match peek_any_next(&lexer) {
2865-
(Token::CommentModule(_), span) => {
2866-
comments.push(lexer.source.index(span));
2867-
let _ = lexer.next_until(|_| true, false);
2868-
}
2869-
_ => {
2870-
break;
2871-
}
2872-
}
2863+
while let (Token::CommentModule(_), span) = peek_any_next(&lexer) {
2864+
comments.push(lexer.source.index(span));
2865+
let _ = lexer.next_until(|_| true, false);
28732866
}
28742867
tu.comments = comments;
28752868
}

naga/src/valid/handles.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ impl super::Validator {
273273
for comment_struct_member_doc in comment_struct_members.iter() {
274274
validate_type(comment_struct_member_doc.0 .0)?;
275275
let struct_type = types.get_handle(comment_struct_member_doc.0 .0).unwrap();
276-
match &struct_type.inner {
276+
match struct_type.inner {
277277
crate::TypeInner::Struct {
278-
members,
279-
span: _span,
278+
ref members,
279+
span: ref _span,
280280
} => {
281281
(0..members.len())
282282
.contains(&comment_struct_member_doc.0 .1)
283-
.then(|| ())
283+
.then_some(())
284284
// TODO: what errors should this be?
285285
.ok_or_else(|| ValidationError::Type {
286286
handle: comment_struct_member_doc.0 .0,
@@ -420,11 +420,11 @@ impl super::Validator {
420420

421421
fn validate_entry_point_index(
422422
entry_point_index: usize,
423-
entry_points: &Vec<EntryPoint>,
423+
entry_points: &[EntryPoint],
424424
) -> Result<(), InvalidHandleError> {
425425
(0..entry_points.len())
426426
.contains(&entry_point_index)
427-
.then(|| ())
427+
.then_some(())
428428
.ok_or_else(|| {
429429
BadHandle {
430430
kind: "EntryPoint",

0 commit comments

Comments
 (0)