Fix warnings

* Allow dead code for curses-only utf8 module
* Remove intermediate variable in IdView
This commit is contained in:
Alexandre Bury 2017-03-27 13:27:50 -07:00
parent 7c95114955
commit d3669814b5
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@ use std::char::from_u32;
/// function to get more if needed. /// function to get more if needed.
/// ///
/// Returns an error if the stream is invalid utf-8. /// Returns an error if the stream is invalid utf-8.
#[allow(dead_code)]
pub fn read_char<F>(first: u8, next: F) -> Result<char, String> pub fn read_char<F>(first: u8, next: F) -> Result<char, String>
where F: Fn() -> Option<u8> where F: Fn() -> Option<u8>
{ {
@ -46,6 +47,7 @@ pub fn read_char<F>(first: u8, next: F) -> Result<char, String>
} }
// Returns a simple bitmask with n 1s to the right. // Returns a simple bitmask with n 1s to the right.
#[allow(dead_code)]
fn make_mask(n: usize) -> u8 { fn make_mask(n: usize) -> u8 {
let mut r = 0u8; let mut r = 0u8;
for i in 0..n { for i in 0..n {

View File

@ -64,11 +64,10 @@ impl<T: View + 'static> ViewWrapper for IdView<T> {
fn wrap_call_on_any<'a>(&mut self, selector: &Selector, fn wrap_call_on_any<'a>(&mut self, selector: &Selector,
mut callback: Box<for<'b> FnMut(&'b mut Any) + 'a>) { mut callback: Box<for<'b> FnMut(&'b mut Any) + 'a>) {
let result = match selector { match selector {
&Selector::Id(id) if id == self.id => callback(self), &Selector::Id(id) if id == self.id => callback(self),
s => self.view.borrow_mut().call_on_any(s, callback), s => self.view.borrow_mut().call_on_any(s, callback),
}; }
result
} }
fn wrap_focus_view(&mut self, selector: &Selector) -> Result<(), ()> { fn wrap_focus_view(&mut self, selector: &Selector) -> Result<(), ()> {