From 3ab16d801206e2132bc1c4c25f20a7c5dd0fb45d Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Sat, 2 Mar 2024 21:36:42 -0500 Subject: [PATCH] Enable `clippy::option_as_ref_deref` (#8747) This PR enables the [`clippy::option_as_ref_deref`](https://rust-lang.github.io/rust-clippy/master/index.html#/option_as_ref_deref) rule and fixes the outstanding violations. Release Notes: - N/A --- crates/project/src/project.rs | 4 ++-- tooling/xtask/src/main.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index a54ab68a43..56ab5c3fc9 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -7123,7 +7123,7 @@ impl Project { .set_local_settings( worktree_id.as_u64() as usize, directory.clone(), - file_content.as_ref().map(String::as_str), + file_content.as_deref(), cx, ) .log_err(); @@ -7424,7 +7424,7 @@ impl Project { .set_local_settings( worktree.entity_id().as_u64() as usize, PathBuf::from(&envelope.payload.path).into(), - envelope.payload.content.as_ref().map(String::as_str), + envelope.payload.content.as_deref(), cx, ) .log_err(); diff --git a/tooling/xtask/src/main.rs b/tooling/xtask/src/main.rs index 57c299b0fe..760be2bdb1 100644 --- a/tooling/xtask/src/main.rs +++ b/tooling/xtask/src/main.rs @@ -108,7 +108,6 @@ fn run_clippy(args: ClippyArgs) -> Result<()> { "clippy::non_canonical_clone_impl", "clippy::non_canonical_partial_ord_impl", "clippy::nonminimal_bool", - "clippy::option_as_ref_deref", "clippy::option_map_unit_fn", "clippy::redundant_closure_call", "clippy::redundant_guards",