mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 03:38:11 +08:00
A few minor lints and docs (#1436)
* A few minor lints and docs * Added required packages to compile on Debian-style linux * Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline) * a few spelling mistakes * fix fmt
This commit is contained in:
@@ -85,7 +85,7 @@ fn set_random_seed(seed: f64) {
|
||||
#[tauri::command]
|
||||
fn handle_message(message: String) -> String {
|
||||
let Ok(message) = ron::from_str::<graphite_editor::messages::message::Message>(&message) else {
|
||||
panic!("Error parsing message: {}", message)
|
||||
panic!("Error parsing message: {message}")
|
||||
};
|
||||
let responses = EDITOR.with(|editor| {
|
||||
let mut editor = editor.borrow_mut();
|
||||
@@ -103,7 +103,7 @@ fn handle_message(message: String) -> String {
|
||||
let path = image.path.clone();
|
||||
let mime = image.mime.clone();
|
||||
let transform = image.transform;
|
||||
images.insert(format!("{:?}_{}", &image.path, document_id), image);
|
||||
images.insert(format!("{:?}_{}", image.path, document_id), image);
|
||||
stub_data.push(FrontendImageData {
|
||||
path,
|
||||
node_id: None,
|
||||
@@ -121,7 +121,7 @@ fn handle_message(message: String) -> String {
|
||||
for response in &responses {
|
||||
let serialized = ron::to_string(&send_frontend_message_to_js(response.clone())).unwrap();
|
||||
if let Err(error) = ron::from_str::<FrontendMessage>(&serialized) {
|
||||
log::error!("Error deserializing message: {}", error);
|
||||
log::error!("Error deserializing message: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ impl JsEditorHandle {
|
||||
}
|
||||
#[cfg(feature = "tauri")]
|
||||
{
|
||||
let identifier = format!("http://localhost:3001/image/{:?}_{}", &image.path, document_id);
|
||||
let identifier = format!("http://localhost:3001/image/{:?}_{}", image.path, document_id);
|
||||
fetchImage(image.path.clone(), image.node_id, image.mime, document_id, identifier);
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ impl JsEditorHandle {
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("tauri response: {:?}\n{:?}", error, _message);
|
||||
log::error!("tauri response: {error:?}\n{_message:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ impl JsEditorHandle {
|
||||
self.dispatch(message);
|
||||
Ok(())
|
||||
}
|
||||
(target, val) => Err(Error::new(&format!("Could not update UI\nDetails:\nTarget: {:?}\nValue: {:?}", target, val)).into()),
|
||||
(target, val) => Err(Error::new(&format!("Could not update UI\nDetails:\nTarget: {target:?}\nValue: {val:?}")).into()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ impl JsEditorHandle {
|
||||
let key = translate_key(&name);
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
trace!("Key down {:?}, name: {}, modifiers: {:?}, key repeat: {}", key, name, modifiers, key_repeat);
|
||||
trace!("Key down {key:?}, name: {name}, modifiers: {modifiers:?}, key repeat: {key_repeat}");
|
||||
|
||||
let message = InputPreprocessorMessage::KeyDown { key, key_repeat, modifier_keys };
|
||||
self.dispatch(message);
|
||||
@@ -446,7 +446,7 @@ impl JsEditorHandle {
|
||||
let key = translate_key(&name);
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
trace!("Key up {:?}, name: {}, modifiers: {:?}, key repeat: {}", key, name, modifier_keys, key_repeat);
|
||||
trace!("Key up {key:?}, name: {name}, modifiers: {modifier_keys:?}, key repeat: {key_repeat}");
|
||||
|
||||
let message = InputPreprocessorMessage::KeyUp { key, key_repeat, modifier_keys };
|
||||
self.dispatch(message);
|
||||
|
||||
@@ -8,7 +8,7 @@ use wasm_bindgen::prelude::*;
|
||||
|
||||
/// When a panic occurs, notify the user and log the error to the JS console before the backend dies
|
||||
pub fn panic_hook(info: &panic::PanicInfo) {
|
||||
error!("{}", info);
|
||||
error!("{info}");
|
||||
|
||||
JS_EDITOR_HANDLES.with(|instances| {
|
||||
instances
|
||||
@@ -68,7 +68,7 @@ impl log::Log for WasmLog {
|
||||
pub fn translate_key(name: &str) -> Key {
|
||||
use Key::*;
|
||||
|
||||
trace!("Key event received: {}", name);
|
||||
trace!("Key event received: {name}");
|
||||
|
||||
match name {
|
||||
// Writing system keys
|
||||
|
||||
Reference in New Issue
Block a user