Clean up some warnings

This commit is contained in:
Bruce Leidl 2020-06-19 10:48:39 -04:00
parent 11920caa72
commit b1f5827096
16 changed files with 24 additions and 24 deletions

View File

@ -179,7 +179,7 @@ impl FieldDialogBuilder {
}
pub fn set_height(&mut self, height: usize) {
self.height = Some(height);;
self.height = Some(height);
}
pub fn height(mut self, height: usize) -> Self {
@ -432,7 +432,7 @@ impl ValidatorResult {
#[derive(Clone)]
pub struct TextValidator {
id: String,
is_valid: Rc<Box<Fn(&str) -> ValidatorResult>>,
is_valid: Rc<Box<dyn Fn(&str) -> ValidatorResult>>,
}
impl TextValidator {

View File

@ -117,7 +117,7 @@ pub struct ItemList<T: Clone + 'static> {
selector: Selector<T>,
last_size: Vec2,
info_state: Rc<ItemRenderState>,
content: Box<ItemListContent<T>>,
content: Box<dyn ItemListContent<T>>,
}
impl <T: Clone + 'static> ItemList<T> {

View File

@ -59,7 +59,7 @@ impl LogView {
}
impl ViewWrapper for LogView {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R

View File

@ -8,7 +8,7 @@ use std::rc::Rc;
pub struct NotesDialog {
inner: ViewBox,
callback: Rc<Fn(&mut Cursive, &str)>,
callback: Rc<dyn Fn(&mut Cursive, &str)>,
}
impl NotesDialog {
@ -62,7 +62,7 @@ impl NotesDialog {
}
impl ViewWrapper for NotesDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R

View File

@ -14,12 +14,12 @@ use crate::notes::NotesDialog;
use cursive::views::Dialog;
use crate::realmfs::RealmFSAction;
type ActionCallback = Fn(&Realm)+Send+Sync;
type ActionCallback = dyn Fn(&Realm)+Send+Sync;
#[derive(Clone)]
pub struct RealmAction {
realm: Realm,
sink: Sender<Box<CbFunc>>,
sink: Sender<Box<dyn CbFunc>>,
callback: Arc<ActionCallback>
}

View File

@ -315,7 +315,7 @@ impl DialogButtonAdapter for ConfigDialog {
}
impl ViewWrapper for ConfigDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R
@ -412,7 +412,7 @@ struct RealmOptions {
}
type Accessor = 'static + (Fn(&mut RealmConfig) -> &mut Option<bool>);
type Accessor = dyn 'static + (Fn(&mut RealmConfig) -> &mut Option<bool>);
impl RealmOptions {

View File

@ -88,7 +88,7 @@ impl DialogButtonAdapter for DeleteRealmDialog {
}
impl ViewWrapper for DeleteRealmDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R

View File

@ -216,7 +216,7 @@ impl DialogButtonAdapter for NewRealmDialog {
}
impl ViewWrapper for NewRealmDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R
@ -392,7 +392,7 @@ impl NewRealmFSDialog {
impl ViewWrapper for NewRealmFSDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R

View File

@ -118,7 +118,7 @@ impl ForkDialog {
}
impl ViewWrapper for ForkDialog {
type V = View;
type V = dyn View;
fn with_view<F, R>(&self, f: F) -> Option<R>
where F: FnOnce(&Self::V) -> R

View File

@ -247,7 +247,7 @@ impl ThemeChooser {
}
impl ViewWrapper for ThemeChooser {
type V = View;
type V = dyn View;
fn with_view<F: FnOnce(&Self::V) -> R, R>(&self, f: F) -> Option<R> { Some(f(&*self.inner)) }
fn with_view_mut<F: FnOnce(&mut Self::V) -> R, R>(&mut self, f: F) -> Option<R> { Some(f(&mut *self.inner)) }

View File

@ -35,10 +35,10 @@ use cursive::rect::Rect;
//use cursive::rect::Rect;
/// Callback taking an item index as input.
type IndexCallback = Rc<Fn(&mut Cursive, usize)>;
type IndexCallback = Rc<dyn Fn(&mut Cursive, usize)>;
/// Callback taking as input the row ID, the collapsed state, and the child ID.
type CollapseCallback = Rc<Fn(&mut Cursive, usize, bool, usize)>;
type CollapseCallback = Rc<dyn Fn(&mut Cursive, usize, bool, usize)>;
/// A low level tree view.
///

View File

@ -395,7 +395,7 @@ impl BootEntry {
// Increment index value and rename boot entry file. Return false
// if new name already exists.
fn rotate(&mut self) -> Result<(bool)> {
fn rotate(&mut self) -> Result<bool> {
let old_path = self.path();
let old_index = self.index;
self.index = match self.index {

View File

@ -5,7 +5,7 @@ use std::fs;
use std::ffi::CString;
use std::os::raw::c_char;
use libc::{self,c_long,c_ulong, c_int, int32_t};
use libc::{self,c_long,c_ulong, c_int};
use hex;
use sodiumoxide::randombytes::randombytes_into;
@ -176,7 +176,7 @@ const KEYCTL_READ : c_int = 11; // read a key or keyring's conte
const KEY_SPEC_USER_KEYRING : c_int = -4; // - key ID for UID-specific keyring
pub struct KernelKey(int32_t);
pub struct KernelKey(i32);
impl KernelKey {

View File

@ -53,7 +53,7 @@ pub trait LogOutput: Send {
pub struct Logger {
level: LogLevel,
output: Box<LogOutput>,
output: Box<dyn LogOutput>,
}
impl Logger {
@ -62,7 +62,7 @@ impl Logger {
logger.level = level;
}
pub fn set_log_output(output: Box<LogOutput>) {
pub fn set_log_output(output: Box<dyn LogOutput>) {
let mut logger = LOGGER.lock().unwrap();
logger.output = output;
}

View File

@ -32,7 +32,7 @@ impl Display for RealmEvent {
}
}
pub type RealmEventHandler = Fn(&RealmEvent)+Send+Sync;
pub type RealmEventHandler = dyn Fn(&RealmEvent)+Send+Sync;
pub struct RealmEventListener {
inner: Arc<RwLock<Inner>>,

View File

@ -12,7 +12,7 @@ pub struct UtsName(libc::utsname);
impl UtsName {
pub fn uname() -> UtsName {
unsafe {
let mut ret: UtsName = mem::uninitialized();
let mut ret: UtsName = mem::zeroed();
libc::uname(&mut ret.0);
ret
}