diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fs/lib.rs | 18 | ||||
-rw-r--r-- | ext/http/lib.rs | 6 | ||||
-rw-r--r-- | ext/webgpu/lib.rs | 7 |
3 files changed, 20 insertions, 11 deletions
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs index 387241ee7..522dea3fb 100644 --- a/ext/fs/lib.rs +++ b/ext/fs/lib.rs @@ -1410,13 +1410,16 @@ where name, is_file: entry .file_type() - .map_or(false, |file_type| file_type.is_file()), + .map(|file_type| file_type.is_file()) + .unwrap_or(false), is_directory: entry .file_type() - .map_or(false, |file_type| file_type.is_dir()), + .map(|file_type| file_type.is_dir()) + .unwrap_or(false), is_symlink: entry .file_type() - .map_or(false, |file_type| file_type.is_symlink()), + .map(|file_type| file_type.is_symlink()) + .unwrap_or(false), }) } else { None @@ -1457,13 +1460,16 @@ where name, is_file: entry .file_type() - .map_or(false, |file_type| file_type.is_file()), + .map(|file_type| file_type.is_file()) + .unwrap_or(false), is_directory: entry .file_type() - .map_or(false, |file_type| file_type.is_dir()), + .map(|file_type| file_type.is_dir()) + .unwrap_or(false), is_symlink: entry .file_type() - .map_or(false, |file_type| file_type.is_symlink()), + .map(|file_type| file_type.is_symlink()) + .unwrap_or(false), }) } else { None diff --git a/ext/http/lib.rs b/ext/http/lib.rs index 31b76cf44..11bd91aa4 100644 --- a/ext/http/lib.rs +++ b/ext/http/lib.rs @@ -553,7 +553,11 @@ fn req_url( .to_string(), ), }; - let path = req.uri().path_and_query().map_or("/", |p| p.as_str()); + let path = req + .uri() + .path_and_query() + .map(|p| p.as_str()) + .unwrap_or("/"); [scheme, "://", &host, path].concat() } diff --git a/ext/webgpu/lib.rs b/ext/webgpu/lib.rs index d399125c7..0cdcf6327 100644 --- a/ext/webgpu/lib.rs +++ b/ext/webgpu/lib.rs @@ -252,10 +252,9 @@ pub async fn op_webgpu_request_adapter( ) -> Result<GpuAdapterDeviceOrErr, AnyError> { let mut state = state.borrow_mut(); check_unstable(&state, "navigator.gpu.requestAdapter"); - let backends = std::env::var("DENO_WEBGPU_BACKEND").map_or_else( - |_| wgpu_types::Backends::all(), - |s| wgpu_core::instance::parse_backends_from_comma_list(&s), - ); + let backends = std::env::var("DENO_WEBGPU_BACKEND") + .map(|s| wgpu_core::instance::parse_backends_from_comma_list(&s)) + .unwrap_or_else(|_| wgpu_types::Backends::all()); let instance = if let Some(instance) = state.try_borrow::<Instance>() { instance } else { |