From 1f16c19cf39b1daf670c29e5451f55ecd4a4bf8d Mon Sep 17 00:00:00 2001 From: scottsauber Date: Sat, 16 Mar 2024 21:03:21 -0500 Subject: [PATCH] refactor: simplify null check --- .../Strategies/LabelTextUsingWrappedElementStrategy.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs b/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs index cd7f3c87c..e0335c054 100644 --- a/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs +++ b/src/bunit.web.query/Labels/Strategies/LabelTextUsingWrappedElementStrategy.cs @@ -14,9 +14,6 @@ internal sealed class LabelTextUsingWrappedElementStrategy : ILabelTextQueryStra .Children .SingleOrDefault(n => n.IsHtmlElementThatCanHaveALabel()); - if (matchingElement is null) - return null; - - return matchingElement.WrapUsing(new ByLabelTextElementFactory(renderedFragment, labelText, options)); + return matchingElement?.WrapUsing(new ByLabelTextElementFactory(renderedFragment, labelText, options)); } }