chore: Fix a beta clippy lint: `clippy::blocks_in_conditions`
This commit is contained in:
parent
1569ecfeae
commit
f9aa6dbea4
|
@ -203,7 +203,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
|
|||
}
|
||||
};
|
||||
|
||||
let body = match std::fs::read(&path).or_else(|e| {
|
||||
let contents = std::fs::read(&path).or_else(|e| {
|
||||
if cfg!(feature = "sandbox") {
|
||||
use rfd::FileDialog;
|
||||
|
||||
|
@ -223,9 +223,17 @@ impl NavigatorBackend for ExternalNavigatorBackend {
|
|||
}
|
||||
|
||||
Err(e)
|
||||
}) {
|
||||
});
|
||||
|
||||
let body = match contents {
|
||||
Ok(body) => body,
|
||||
Err(e) => return create_specific_fetch_error("Can't open file", response_url.as_str(), e)
|
||||
Err(e) => {
|
||||
return create_specific_fetch_error(
|
||||
"Can't open file",
|
||||
response_url.as_str(),
|
||||
e,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
Ok(SuccessResponse {
|
||||
|
@ -393,13 +401,12 @@ impl NavigatorBackend for ExternalNavigatorBackend {
|
|||
|
||||
let host2 = host.clone();
|
||||
|
||||
let stream = match TcpStream::connect((host, port))
|
||||
.or(async {
|
||||
Timer::after(timeout).await;
|
||||
Result::<TcpStream, io::Error>::Err(io::Error::new(ErrorKind::TimedOut, ""))
|
||||
})
|
||||
.await
|
||||
{
|
||||
let timeout = async {
|
||||
Timer::after(timeout).await;
|
||||
Result::<TcpStream, io::Error>::Err(io::Error::new(ErrorKind::TimedOut, ""))
|
||||
};
|
||||
|
||||
let stream = match TcpStream::connect((host, port)).or(timeout).await {
|
||||
Err(e) if e.kind() == ErrorKind::TimedOut => {
|
||||
warn!("Connection to {}:{} timed out", host2, port);
|
||||
sender
|
||||
|
|
|
@ -137,7 +137,7 @@ fn take_screenshot(
|
|||
|
||||
player.lock().unwrap().run_frame();
|
||||
if i >= skipframes {
|
||||
match catch_unwind(|| {
|
||||
let image = || {
|
||||
player.lock().unwrap().render();
|
||||
let mut player = player.lock().unwrap();
|
||||
let renderer = player
|
||||
|
@ -145,7 +145,8 @@ fn take_screenshot(
|
|||
.downcast_mut::<WgpuRenderBackend<TextureTarget>>()
|
||||
.unwrap();
|
||||
renderer.capture_frame()
|
||||
}) {
|
||||
};
|
||||
match catch_unwind(image) {
|
||||
Ok(Some(image)) => result.push(image),
|
||||
Ok(None) => return Err(anyhow!("Unable to capture frame {} of {:?}", i, swf_path)),
|
||||
Err(e) => {
|
||||
|
|
Loading…
Reference in New Issue