style(engine): fix formatting

This commit is contained in:
Federico Terzi 2021-10-06 18:38:02 +02:00
parent d11af8b1c2
commit 8fe508bf93
4 changed files with 34 additions and 12 deletions

View File

@ -19,7 +19,8 @@
use log::trace; use log::trace;
use super::{DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvider, MatchProvider, MatchSelector, Matcher, MatcherMiddlewareConfigProvider, Middleware, Multiplexer, PathProvider, Processor, Renderer, UndoEnabledProvider, middleware::{ use super::{
middleware::{
action::{ActionMiddleware, EventSequenceProvider}, action::{ActionMiddleware, EventSequenceProvider},
cause::CauseCompensateMiddleware, cause::CauseCompensateMiddleware,
cursor_hint::CursorHintMiddleware, cursor_hint::CursorHintMiddleware,
@ -30,8 +31,20 @@ use super::{DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvide
multiplex::MultiplexMiddleware, multiplex::MultiplexMiddleware,
past_discard::PastEventsDiscardMiddleware, past_discard::PastEventsDiscardMiddleware,
render::RenderMiddleware, render::RenderMiddleware,
}}; },
use crate::{event::{Event, EventType}, process::middleware::{context_menu::ContextMenuMiddleware, disable::DisableMiddleware, exit::ExitMiddleware, hotkey::HotKeyMiddleware, icon_status::IconStatusMiddleware, image_resolve::ImageResolverMiddleware, search::SearchMiddleware, suppress::SuppressMiddleware, undo::UndoMiddleware}}; DisableOptions, EnabledStatusProvider, MatchFilter, MatchInfoProvider, MatchProvider,
MatchSelector, Matcher, MatcherMiddlewareConfigProvider, Middleware, Multiplexer, PathProvider,
Processor, Renderer, UndoEnabledProvider,
};
use crate::{
event::{Event, EventType},
process::middleware::{
context_menu::ContextMenuMiddleware, disable::DisableMiddleware, exit::ExitMiddleware,
hotkey::HotKeyMiddleware, icon_status::IconStatusMiddleware,
image_resolve::ImageResolverMiddleware, search::SearchMiddleware, suppress::SuppressMiddleware,
undo::UndoMiddleware,
},
};
use std::collections::VecDeque; use std::collections::VecDeque;
pub struct DefaultProcessor<'a> { pub struct DefaultProcessor<'a> {

View File

@ -18,7 +18,9 @@
*/ */
use super::super::Middleware; use super::super::Middleware;
use crate::{event::{Event, EventType, effect::TriggerCompensationEvent, internal::CauseCompensatedMatchEvent}}; use crate::event::{
effect::TriggerCompensationEvent, internal::CauseCompensatedMatchEvent, Event, EventType,
};
pub struct CauseCompensateMiddleware {} pub struct CauseCompensateMiddleware {}
@ -35,17 +37,24 @@ impl Middleware for CauseCompensateMiddleware {
fn next(&self, event: Event, dispatch: &mut dyn FnMut(Event)) -> Event { fn next(&self, event: Event, dispatch: &mut dyn FnMut(Event)) -> Event {
if let EventType::MatchSelected(m_event) = &event.etype { if let EventType::MatchSelected(m_event) = &event.etype {
let compensated_event = let compensated_event = Event::caused_by(
Event::caused_by(event.source_id, EventType::CauseCompensatedMatch(CauseCompensatedMatchEvent { m: m_event.chosen.clone() })); event.source_id,
EventType::CauseCompensatedMatch(CauseCompensatedMatchEvent {
m: m_event.chosen.clone(),
}),
);
if let Some(trigger) = &m_event.chosen.trigger { if let Some(trigger) = &m_event.chosen.trigger {
dispatch(compensated_event); dispatch(compensated_event);
// Before the event, place a trigger compensation // Before the event, place a trigger compensation
return Event::caused_by(event.source_id, EventType::TriggerCompensation(TriggerCompensationEvent { return Event::caused_by(
event.source_id,
EventType::TriggerCompensation(TriggerCompensationEvent {
trigger: trigger.clone(), trigger: trigger.clone(),
left_separator: m_event.chosen.left_separator.clone(), left_separator: m_event.chosen.left_separator.clone(),
})); }),
);
} else { } else {
return compensated_event; return compensated_event;
} }