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
merge-requests/23/head
Nefo Fortressia 2021-12-18 17:21:50 +07:00
parent c8fd305d90
commit 8e31be7e47
Signed by: fortressia
GPG Key ID: 6D7972CC76174995
1 changed files with 3 additions and 2 deletions

View File

@ -17,8 +17,9 @@ impl TabLabel {
pub fn new<U: IsA<gtk::Widget>>(tab_label: Option<&U>) -> Self { pub fn new<U: IsA<gtk::Widget>>(tab_label: Option<&U>) -> Self {
let this: Self = glib::Object::new(&[]).expect("Failed to create 'TabLabel' component."); let this: Self = glib::Object::new(&[]).expect("Failed to create 'TabLabel' component.");
if tab_label.is_some() { match tab_label {
this.prepend(tab_label.unwrap()); Some(tab_label) => this.prepend(tab_label),
None => {}
} }
this this
} }