Fix clippy warnings

Add default implementations
Return &mut View instead of &mut Box<View>
This commit is contained in:
Alexandre Bury 2017-07-18 01:43:50 +02:00
parent 2ffae1f524
commit 22b8364877
3 changed files with 14 additions and 2 deletions

View File

@ -31,9 +31,9 @@ impl ListChild {
} }
} }
fn view(&mut self) -> Option<&mut Box<View>> { fn view(&mut self) -> Option<&mut View> {
match *self { match *self {
ListChild::Row(_, ref mut view) => Some(view), ListChild::Row(_, ref mut view) => Some(view.as_mut()),
_ => None, _ => None,
} }
} }

View File

@ -32,6 +32,12 @@ pub struct RadioGroup<T> {
state: Rc<RefCell<SharedState<T>>>, state: Rc<RefCell<SharedState<T>>>,
} }
impl <T> Default for RadioGroup<T> {
fn default() -> Self {
Self::new()
}
}
impl<T> RadioGroup<T> { impl<T> RadioGroup<T> {
/// Creates an empty group for radio buttons. /// Creates an empty group for radio buttons.
pub fn new() -> Self { pub fn new() -> Self {

View File

@ -67,6 +67,12 @@ pub struct SelectView<T = String> {
last_size: Vec2, last_size: Vec2,
} }
impl <T: 'static> Default for SelectView<T> {
fn default() -> Self {
Self::new()
}
}
impl<T: 'static> SelectView<T> { impl<T: 'static> SelectView<T> {
/// Creates a new empty SelectView. /// Creates a new empty SelectView.
pub fn new() -> Self { pub fn new() -> Self {