浏览代码

Tiny aesthetic tweaks

Jonathan Kelley 1 年之前
父节点
当前提交
127709f83f
共有 3 个文件被更改,包括 4 次插入17 次删除
  1. 2 2
      packages/core/src/scope_context.rs
  2. 1 1
      packages/desktop/src/app.rs
  3. 1 14
      packages/desktop/src/edits.rs

+ 2 - 2
packages/core/src/scope_context.rs

@@ -269,8 +269,8 @@ impl ScopeContext {
             .get(cur_hook)
             .and_then(|inn| {
                 self.hook_index.set(cur_hook + 1);
-                let raw_ref: & dyn Any = inn.as_ref();
-                raw_ref.downcast_ref    ::<State>().cloned()
+                let raw_ref: &dyn Any = inn.as_ref();
+                raw_ref.downcast_ref::<State>().cloned()
             })
             .expect(
                 r#"

+ 1 - 1
packages/desktop/src/app.rs

@@ -50,7 +50,7 @@ pub(crate) struct App {
 /// A bundle of state shared between all the windows, providing a way for us to communicate with running webview.
 ///
 /// Todo: everything in this struct is wrapped in Rc<>, but we really only need the one top-level refcell
-pub struct SharedContext {
+pub(crate) struct SharedContext {
     pub(crate) event_handlers: WindowEventHandlers,
     pub(crate) pending_webviews: RefCell<Vec<WebviewInstance>>,
     pub(crate) shortcut_manager: ShortcutRegistry,

+ 1 - 14
packages/desktop/src/edits.rs

@@ -1,6 +1,4 @@
-use std::{cell::RefCell, rc::Rc, sync::Arc, sync::Mutex};
-
-use std::fmt::{Debug, Formatter};
+use std::{cell::RefCell, rc::Rc};
 
 /// This handles communication between the requests that the webview makes and the interpreter. The interpreter constantly makes long running requests to the webview to get any edits that should be made to the DOM almost like server side events.
 /// It will hold onto the requests until the interpreter is ready to handle them and hold onto any pending edits until a new request is made.
@@ -10,17 +8,6 @@ pub(crate) struct EditQueue {
     responder: Rc<RefCell<Option<wry::RequestAsyncResponder>>>,
 }
 
-impl Debug for EditQueue {
-    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
-        f.debug_struct("EditQueue")
-            .field("queue", &self.queue)
-            .field("responder", {
-                &self.responder.borrow().as_ref().map(|_| ())
-            })
-            .finish()
-    }
-}
-
 impl EditQueue {
     pub fn handle_request(&self, responder: wry::RequestAsyncResponder) {
         let mut queue = self.queue.borrow_mut();