From 8e31be7e47e3129e69db3b54f07e68a73feb7c29 Mon Sep 17 00:00:00 2001 From: Nefo Fortressia Date: Sat, 18 Dec 2021 17:21:50 +0700 Subject: [PATCH] refactor: don't unwrap tab label' childs and use match when prepending it If statements are for booleans, matches are intended for Options like these. See: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap --- src/components/tab_label/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/tab_label/mod.rs b/src/components/tab_label/mod.rs index 1b45623..e47b028 100644 --- a/src/components/tab_label/mod.rs +++ b/src/components/tab_label/mod.rs @@ -17,8 +17,9 @@ impl TabLabel { pub fn new>(tab_label: Option<&U>) -> Self { let this: Self = glib::Object::new(&[]).expect("Failed to create 'TabLabel' component."); - if tab_label.is_some() { - this.prepend(tab_label.unwrap()); + match tab_label { + Some(tab_label) => this.prepend(tab_label), + None => {} } this }