mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
chore: satisfy clippy::unnecessary_map_or in Rust 1.85
This commit is contained in:
1 parent
4200136e2c
commit
f234ff27ab
4 files changed
+5
-7
No files matched your search
@@ -2203,8 +2203,7 @@ impl<'a, W: Write> Writer<'a, W> {
|
||||
self.write_stmt(sta, ctx, l2.next())?;
|
||||
}
|
||||
|
||||
if !case.fall_through
|
||||
&& case.body.last().map_or(true, |s| !s.is_terminator())
|
||||
if !case.fall_through && case.body.last().is_none_or(|s| !s.is_terminator())
|
||||
{
|
||||
writeln!(self.out, "{}break;", l2.next())?;
|
||||
}
|
||||
|
||||
@@ -1715,14 +1715,14 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
|
||||
}
|
||||
|
||||
let last_case = &cases[end_case_idx];
|
||||
if last_case.body.last().map_or(true, |s| !s.is_terminator()) {
|
||||
if last_case.body.last().is_none_or(|s| !s.is_terminator()) {
|
||||
writeln!(self.out, "{indent_level_2}break;")?;
|
||||
}
|
||||
} else {
|
||||
for sta in case.body.iter() {
|
||||
self.write_stmt(module, sta, func_ctx, indent_level_2)?;
|
||||
}
|
||||
if !case.fall_through && case.body.last().map_or(true, |s| !s.is_terminator()) {
|
||||
if !case.fall_through && case.body.last().is_none_or(|s| !s.is_terminator()) {
|
||||
writeln!(self.out, "{indent_level_2}break;")?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3223,8 +3223,7 @@ impl<W: Write> Writer<W> {
|
||||
}
|
||||
|
||||
self.put_block(lcase.next(), &case.body, context)?;
|
||||
if !case.fall_through
|
||||
&& case.body.last().map_or(true, |s| !s.is_terminator())
|
||||
if !case.fall_through && case.body.last().is_none_or(|s| !s.is_terminator())
|
||||
{
|
||||
writeln!(self.out, "{}break;", lcase.next())?;
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ impl BlockContext<'_> {
|
||||
let body = lower_impl(blocks, bodies, body_idx);
|
||||
|
||||
// Handle simple cases that would make a fallthrough statement unreachable code
|
||||
let fall_through = body.last().map_or(true, |s| !s.is_terminator());
|
||||
let fall_through = body.last().is_none_or(|s| !s.is_terminator());
|
||||
|
||||
crate::SwitchCase {
|
||||
value: crate::SwitchValue::I32(value),
|
||||
|
||||
Reference in new issue
Block a user