Fix clippy::type_complexity, refactor type alias
Use a type alias to refactor the submit_funcs type definition, as a vector of boxed SubmitFuncs. Note this type alias isn't used in the parameterized add_submit_func() function because it accepts a trait, not a type - no `dyn` keyword in this context, but it is needed in the type definition.
This commit is contained in:
parent
46535904bc
commit
e8558b427a
|
@ -1494,6 +1494,8 @@ impl Button {
|
|||
}
|
||||
}
|
||||
|
||||
type SubmitFunc = dyn Fn(&mut TextBox, &mut crate::Game);
|
||||
|
||||
element! {
|
||||
ref TextBoxRef
|
||||
pub struct TextBox {
|
||||
|
@ -1505,7 +1507,7 @@ element! {
|
|||
priv text: Option<TextRef>,
|
||||
priv was_focused: bool,
|
||||
priv cursor_tick: f64,
|
||||
priv submit_funcs: Vec<Box<dyn Fn(&mut TextBox, &mut crate::Game)>>,
|
||||
priv submit_funcs: Vec<Box<SubmitFunc>>,
|
||||
}
|
||||
builder TextBoxBuilder {
|
||||
hardcode button = None,
|
||||
|
|
Loading…
Reference in New Issue