From 10ca02f59123875712c8632d787cea06acbf463c Mon Sep 17 00:00:00 2001 From: Brad Dunbar Date: Sat, 20 Jan 2024 10:14:49 -0500 Subject: [PATCH] Remove an unnecessary else The if block above always returns, acting as a guard, so there's no reason for an else here. --- src/bytes_mut.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 88d596cf6..0f5095714 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -726,11 +726,11 @@ impl BytesMut { } return; - } else { - new_cap = cmp::max(new_cap, original_capacity); } } + new_cap = cmp::max(new_cap, original_capacity); + // Create a new vector to store the data let mut v = ManuallyDrop::new(Vec::with_capacity(new_cap));