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_unwrapmerge-requests/23/head
parent
c8fd305d90
commit
8e31be7e47
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue