1
0
Fork 0

Remove more trait parameters

This commit is contained in:
Malte Brandy 2018-06-09 16:03:36 +02:00
parent c03420d8fe
commit b1549ad544
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
2 changed files with 6 additions and 6 deletions

View file

@ -17,7 +17,7 @@ use error::{Result, ResultExt};
use hotkeys::Next::*;
pub fn run<T: Into<String>>(name: T, command: &str) -> Item {
pub fn run(name: impl Into<String>, command: &str) -> Item {
let command = command.to_owned();
(
name.into(),
@ -28,7 +28,7 @@ pub fn run<T: Into<String>>(name: T, command: &str) -> Item {
)
}
pub fn run_cmd<T: Into<String>>(name: T, command: Command) -> Item {
pub fn run_cmd(name: impl Into<String>, command: Command) -> Item {
(
name.into(),
Do(Rc::new(move || {
@ -47,11 +47,11 @@ pub fn term_cmd(command: &str) -> String {
)
}
pub fn term<T: Into<String>>(name: T, command: &str) -> Item {
pub fn term(name: impl Into<String>, command: &str) -> Item {
run(name, &term_cmd(command))
}
pub fn menu<T: Into<String>>(name: T, options: Vec<Item>) -> Item {
pub fn menu(name: impl Into<String>, options: Vec<Item>) -> Item {
let name = name.into();
(name.clone(), Menu((name.clone(), options)))
}
@ -71,7 +71,7 @@ type Item = (String, Next);
type Command = Vec<String>;
fn show_menu<T: DialogProvider>(dialog_provider: &mut T, menu: Dialog) -> Result<Next> {
fn show_menu(dialog_provider: &mut impl DialogProvider, menu: Dialog) -> Result<Next> {
let (msg, mut options) = menu;
options.insert(0, (".Back".into(), Back));
match dialog_provider.select_option(msg, options) {

View file

@ -208,7 +208,7 @@ impl Kassandra {
Ok(())
}
fn get_sorted_uuids<T: Fn(&Task) -> bool>(&self, filter: T) -> Vec<Uuid> {
fn get_sorted_uuids(&self, filter: impl Fn(&Task) -> bool) -> Vec<Uuid> {
self.get_sorted_tasks(filter)
.into_iter()
.map(|x| x.uuid().clone())