diff --git a/src/backend/curses.rs b/src/backend/curses.rs index 7bb8bc0..21cba50 100644 --- a/src/backend/curses.rs +++ b/src/backend/curses.rs @@ -1,6 +1,6 @@ use backend; use event::{Event, Key}; -use theme::{Color, ColorStyle, Effect, BaseColor}; +use theme::{BaseColor, Color, ColorStyle, Effect}; use utf8; use ncurses; diff --git a/src/lib.rs b/src/lib.rs index 61fb6a6..e811fcd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -347,7 +347,8 @@ impl Cursive { /// }); /// # } /// ``` - pub fn find(&mut self, sel: &view::Selector) -> Option<&mut V> { + pub fn find(&mut self, sel: &view::Selector) + -> Option<&mut V> { self.screen_mut().find(sel) } @@ -445,7 +446,9 @@ impl Cursive { fn draw(&mut self) { // TODO: don't clone the theme // Reference it or something - let printer = Printer::new(self.screen_size(), self.theme.clone(), &mut self.backend); + let printer = Printer::new(self.screen_size(), + self.theme.clone(), + &self.backend); // Draw the currently active screen // If the menubar is active, nothing else can be. diff --git a/src/prelude.rs b/src/prelude.rs index 180dbfd..c7b24f3 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -8,15 +8,20 @@ #[doc(no_inline)] pub use {Cursive, Printer, With}; + #[doc(no_inline)] pub use event::{Event, Key}; + #[doc(no_inline)] pub use view::{Boxable, Finder, Identifiable, Selector, View}; + #[doc(no_inline)] pub use views::{BoxView, Button, Checkbox, Dialog, DummyView, EditView, IdView, KeyEventView, LinearLayout, ListView, Panel, ProgressBar, SelectView, SliderView, TextArea, TextView}; + #[doc(no_inline)] pub use vec::Vec2; + #[doc(no_inline)] pub use menu::MenuTree; diff --git a/src/printer.rs b/src/printer.rs index 31f0fa8..c42c50c 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -25,7 +25,7 @@ pub struct Printer<'a> { backend: &'a B, } -impl <'a> Printer<'a> { +impl<'a> Printer<'a> { /// Creates a new printer on the given window. /// /// But nobody needs to know that. diff --git a/src/utils/lines_iterator.rs b/src/utils/lines_iterator.rs index 25f8268..00feef6 100644 --- a/src/utils/lines_iterator.rs +++ b/src/utils/lines_iterator.rs @@ -130,7 +130,7 @@ impl<'a> Iterator for LinesIterator<'a> { // would include the whitespace in the row. self.offset += 1; other - }, + } }; if prefix_length == 0 { @@ -154,6 +154,5 @@ impl<'a> Iterator for LinesIterator<'a> { mod tests { #[test] - fn test_layout() { - } + fn test_layout() {} } diff --git a/src/view/boxable.rs b/src/view/boxable.rs index 09cd182..f3f90df 100644 --- a/src/view/boxable.rs +++ b/src/view/boxable.rs @@ -6,9 +6,9 @@ use vec::Vec2; /// /// [`BoxView`]: ../views/struct.BoxView.html pub trait Boxable: View + Sized { - /// Wraps `self` in a `BoxView` with the given size constraints. - fn boxed(self, width: SizeConstraint, height: SizeConstraint) -> BoxView { + fn boxed(self, width: SizeConstraint, height: SizeConstraint) + -> BoxView { BoxView::new(width, height, self) } diff --git a/src/view/mod.rs b/src/view/mod.rs index dee0391..675975d 100644 --- a/src/view/mod.rs +++ b/src/view/mod.rs @@ -146,7 +146,6 @@ pub trait View { /// /// [`View::find_any`]: ./trait.View.html#method.find_any pub trait Finder { - /// Tries to find the view pointed to by the given selector. /// /// If the view is not found, or if it is not of the asked type, @@ -159,7 +158,7 @@ pub trait Finder { } } -impl Finder for T { +impl Finder for T { fn find(&mut self, sel: &Selector) -> Option<&mut V> { self.find_any(sel).and_then(|b| b.downcast_mut::()) } diff --git a/src/view/position.rs b/src/view/position.rs index 460f3c1..c5cdac1 100644 --- a/src/view/position.rs +++ b/src/view/position.rs @@ -80,7 +80,7 @@ impl Offset { mod tests { use vec::Vec2; - use super::{Position}; + use super::Position; #[test] fn test_center() { diff --git a/src/view/size_constraint.rs b/src/view/size_constraint.rs index 2b21a1e..d655261 100644 --- a/src/view/size_constraint.rs +++ b/src/view/size_constraint.rs @@ -20,7 +20,6 @@ pub enum SizeConstraint { } impl SizeConstraint { - /// Returns the size to be given to the child. /// /// When `available` is offered to the `BoxView`. diff --git a/src/views/box_view.rs b/src/views/box_view.rs index a9824a4..ec08963 100644 --- a/src/views/box_view.rs +++ b/src/views/box_view.rs @@ -181,7 +181,7 @@ impl ViewWrapper for BoxView { mod tests { use vec::Vec2; - use view::{View, Boxable}; + use view::{Boxable, View}; use views::DummyView; // No need to test `draw()` method as it's directly forwarded. diff --git a/src/views/key_event_view.rs b/src/views/key_event_view.rs index 8e9e05b..cf25ca5 100644 --- a/src/views/key_event_view.rs +++ b/src/views/key_event_view.rs @@ -21,7 +21,7 @@ pub struct KeyEventView { callbacks: HashMap, } -impl KeyEventView { +impl KeyEventView { /// Wraps the given view in a new KeyEventView. pub fn new(view: T) -> Self { KeyEventView { @@ -40,7 +40,7 @@ impl KeyEventView { } } -impl ViewWrapper for KeyEventView { +impl ViewWrapper for KeyEventView { wrap_impl!(self.content: T); fn wrap_on_event(&mut self, event: Event) -> EventResult { diff --git a/src/views/menubar.rs b/src/views/menubar.rs index 4d7f862..664a839 100644 --- a/src/views/menubar.rs +++ b/src/views/menubar.rs @@ -1,10 +1,10 @@ use Cursive; -use view::{View, Position}; +use view::{Position, View}; use vec::Vec2; use direction; use menu::MenuTree; use backend::Backend; -use views::{MenuPopup, KeyEventView}; +use views::{KeyEventView, MenuPopup}; use theme::ColorStyle; use Printer; use event::*; diff --git a/src/views/mod.rs b/src/views/mod.rs index 5124953..99b0124 100644 --- a/src/views/mod.rs +++ b/src/views/mod.rs @@ -23,7 +23,7 @@ mod text_area; mod text_view; mod tracked_view; -pub use self::id_view::{IdView}; +pub use self::id_view::IdView; pub use self::box_view::BoxView; pub use self::button::Button; pub use self::checkbox::Checkbox; diff --git a/src/views/text_area.rs b/src/views/text_area.rs index fa04ead..742992e 100644 --- a/src/views/text_area.rs +++ b/src/views/text_area.rs @@ -334,7 +334,7 @@ impl TextArea { // First attempt, if scrollbase status didn't change. // println_stderr!("Rows: {:?}", self.rows); let new_rows = make_rows(&self.content[first_byte..last_byte], - available); + available); // How much did this add? // println_stderr!("New rows: {:?}", new_rows); // println_stderr!("{}-{}", first_row, last_row); diff --git a/src/views/text_view.rs b/src/views/text_view.rs index 9716496..c23b0a9 100644 --- a/src/views/text_view.rs +++ b/src/views/text_view.rs @@ -8,7 +8,7 @@ use align::*; use event::*; use view::ScrollBase; -use utils::{Row, LinesIterator}; +use utils::{LinesIterator, Row}; use unicode_width::UnicodeWidthStr;