Apply rustfmt

This commit is contained in:
Alexandre Bury 2016-09-22 22:10:14 -07:00
parent d29f80869d
commit 2e06dd70cb
15 changed files with 26 additions and 21 deletions

View File

@ -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;

View File

@ -347,7 +347,8 @@ impl Cursive {
/// });
/// # }
/// ```
pub fn find<V: View + Any>(&mut self, sel: &view::Selector) -> Option<&mut V> {
pub fn find<V: View + Any>(&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.

View File

@ -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;

View File

@ -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.

View File

@ -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() {}
}

View File

@ -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<Self> {
fn boxed(self, width: SizeConstraint, height: SizeConstraint)
-> BoxView<Self> {
BoxView::new(width, height, self)
}

View File

@ -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 <T: View> Finder for T {
impl<T: View> Finder for T {
fn find<V: View + Any>(&mut self, sel: &Selector) -> Option<&mut V> {
self.find_any(sel).and_then(|b| b.downcast_mut::<V>())
}

View File

@ -80,7 +80,7 @@ impl Offset {
mod tests {
use vec::Vec2;
use super::{Position};
use super::Position;
#[test]
fn test_center() {

View File

@ -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`.

View File

@ -181,7 +181,7 @@ impl<T: View> ViewWrapper for BoxView<T> {
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.

View File

@ -21,7 +21,7 @@ pub struct KeyEventView<T: View> {
callbacks: HashMap<Event, Callback>,
}
impl <T: View> KeyEventView<T> {
impl<T: View> KeyEventView<T> {
/// Wraps the given view in a new KeyEventView.
pub fn new(view: T) -> Self {
KeyEventView {
@ -40,7 +40,7 @@ impl <T: View> KeyEventView<T> {
}
}
impl <T: View> ViewWrapper for KeyEventView<T> {
impl<T: View> ViewWrapper for KeyEventView<T> {
wrap_impl!(self.content: T);
fn wrap_on_event(&mut self, event: Event) -> EventResult {

View File

@ -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::*;

View File

@ -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;

View File

@ -8,7 +8,7 @@ use align::*;
use event::*;
use view::ScrollBase;
use utils::{Row, LinesIterator};
use utils::{LinesIterator, Row};
use unicode_width::UnicodeWidthStr;