From e58b683201066462dfbde33eb2857783d1c1b920 Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Fri, 19 Jan 2024 15:41:23 +0100 Subject: [PATCH] needless_return --- Cargo.toml | 1 - crates/hir/src/lib.rs | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e4ad41b6e6..b9b3d3d8f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -176,7 +176,6 @@ forget_non_drop = "allow" format_collect = "allow" large_enum_variant = "allow" needless_doctest_main = "allow" -needless_return = "allow" new_without_default = "allow" nonminimal_bool = "allow" non_canonical_clone_impl = "allow" diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 3adeef6c18..3ec60ca69e 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -2404,10 +2404,10 @@ impl Const { } } if let Ok(s) = mir::render_const_using_debug_impl(db, self.id, &c) { - return Ok(s); + Ok(s) + } else { + Ok(format!("{}", c.display(db))) } - let r = format!("{}", c.display(db)); - return Ok(r); } }