Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

refactor: avoid complex type warning (#3570)

Andrew Dunbar9318483cf950
diff --git a/harper-desktop/src-tauri/src/mac_broker.rs b/harper-desktop/src-tauri/src/mac_broker.rs
index e9ed5a2cb..9eb76a5fd 100644
--- a/harper-desktop/src-tauri/src/mac_broker.rs
+++ b/harper-desktop/src-tauri/src/mac_broker.rs
@@ -310,11 +310,10 @@ impl Drop for MacBroker {
}
}
+type LintCallback<'a> = dyn FnMut(&str) -> BTreeMap<String, Vec<Lint>> + 'a;
+
impl OsBroker for MacBroker {
- fn get_boxes(
- &mut self,
- lint_text: &mut dyn FnMut(&str) -> BTreeMap<String, Vec<Lint>>,
- ) -> Vec<ActionableLint> {
+ fn get_boxes(&mut self, lint_text: &mut LintCallback) -> Vec<ActionableLint> {
let pid = match self.target_pid() {
Ok(Some(pid)) => pid,
Ok(None) => {
@@ -926,7 +925,7 @@ impl TreeVisitor for AccessibilityActivationProbe {
struct RectCollector<'a> {
rects: RefCell<Vec<ActionableLint>>,
- lint_text: RefCell<&'a mut dyn FnMut(&str) -> BTreeMap<String, Vec<Lint>>>,
+ lint_text: RefCell<&'a mut LintCallback<'a>>,
}
impl TreeVisitor for RectCollector<'_> {
@@ -977,7 +976,7 @@ impl TreeVisitor for RectCollector<'_> {
}
impl<'a> RectCollector<'a> {
- fn new(lint_text: &'a mut dyn FnMut(&str) -> BTreeMap<String, Vec<Lint>>) -> Self {
+ fn new(lint_text: &'a mut LintCallback) -> Self {
Self {
rects: RefCell::new(Vec::new()),
lint_text: RefCell::new(lint_text),