diff --git a/apps/api/src/main.rs b/apps/api/src/main.rs index 3552a8d023..60dd3080a1 100644 --- a/apps/api/src/main.rs +++ b/apps/api/src/main.rs @@ -28,7 +28,7 @@ pub const DEVICE_FINGERPRINT_HEADER: &str = "x-device-fingerprint"; async fn app() -> Router { let env = env(); - let analytics = build_analytics_client(&env); + let analytics = build_analytics_client(env); let llm_config = hypr_llm_proxy::LlmProxyConfig::new(&env.llm).with_analytics(analytics.clone()); diff --git a/crates/template-app/src/lib.rs b/crates/template-app/src/lib.rs index e01436da13..cd6b7cd207 100644 --- a/crates/template-app/src/lib.rs +++ b/crates/template-app/src/lib.rs @@ -24,7 +24,7 @@ macro_rules! common_derives { common_derives! { pub enum Template { EnhanceSystem(EnhanceSystem), - EnhanceUser(EnhanceUser), + EnhanceUser(Box), TitleSystem(TitleSystem), TitleUser(TitleUser), ChatSystem(ChatSystem), @@ -46,7 +46,7 @@ pub enum Error { pub fn render(t: Template) -> Result { let value = match t { Template::EnhanceSystem(t) => askama::Template::render(&t), - Template::EnhanceUser(t) => askama::Template::render(&t), + Template::EnhanceUser(t) => askama::Template::render(&*t), Template::TitleSystem(t) => askama::Template::render(&t), Template::TitleUser(t) => askama::Template::render(&t), Template::ChatSystem(t) => askama::Template::render(&t), diff --git a/crates/tiptap/src/validate.rs b/crates/tiptap/src/validate.rs index e0a4b9cf2a..f7c7d20449 100644 --- a/crates/tiptap/src/validate.rs +++ b/crates/tiptap/src/validate.rs @@ -70,13 +70,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if !is_block_type(ct) { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("doc child must be a block node, got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && !is_block_type(ct) + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("doc child must be a block node, got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -85,13 +85,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { "paragraph" => { for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if !is_inline_type(ct) { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("paragraph child must be an inline node, got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && !is_inline_type(ct) + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("paragraph child must be an inline node, got '{ct}'"), + }); } } } @@ -99,13 +99,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { "heading" => { for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if !is_inline_type(ct) { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("heading child must be an inline node, got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && !is_inline_type(ct) + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("heading child must be an inline node, got '{ct}'"), + }); } } } @@ -120,13 +120,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if ct != "listItem" { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("bulletList child must be 'listItem', got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && ct != "listItem" + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("bulletList child must be 'listItem', got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -143,13 +143,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if ct != "listItem" { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("orderedList child must be 'listItem', got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && ct != "listItem" + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("orderedList child must be 'listItem', got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -165,13 +165,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if ct != "taskItem" { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("taskList child must be 'taskItem', got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && ct != "taskItem" + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("taskList child must be 'taskItem', got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -198,13 +198,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if !is_block_type(ct) { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("{typ} child must be a block node, got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && !is_block_type(ct) + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("{typ} child must be a block node, got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -221,13 +221,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { } for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if !is_block_type(ct) { - errors.push(ValidationError { - path: child_path.clone(), - message: format!("blockquote child must be a block node, got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && !is_block_type(ct) + { + errors.push(ValidationError { + path: child_path.clone(), + message: format!("blockquote child must be a block node, got '{ct}'"), + }); } validate_node(child, &child_path, errors); } @@ -236,13 +236,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec) { "codeBlock" => { for (i, child) in content.iter().enumerate() { let child_path = format!("{path}.content[{i}]"); - if let Some(ct) = node_type(child) { - if ct != "text" { - errors.push(ValidationError { - path: child_path, - message: format!("codeBlock child must be 'text', got '{ct}'"), - }); - } + if let Some(ct) = node_type(child) + && ct != "text" + { + errors.push(ValidationError { + path: child_path, + message: format!("codeBlock child must be 'text', got '{ct}'"), + }); } } } diff --git a/plugins/deeplink2/src/server/mod.rs b/plugins/deeplink2/src/server/mod.rs index 353cc229d6..6a7747ce93 100644 --- a/plugins/deeplink2/src/server/mod.rs +++ b/plugins/deeplink2/src/server/mod.rs @@ -33,6 +33,12 @@ pub struct CallbackServerState { active_port: Mutex>, } +impl Default for CallbackServerState { + fn default() -> Self { + Self::new() + } +} + impl CallbackServerState { pub fn new() -> Self { Self { @@ -196,10 +202,10 @@ async fn serve( if let Ok(mut servers) = state.servers.lock() { servers.remove(&port); } - if let Ok(mut active) = state.active_port.lock() { - if *active == Some(port) { - *active = None; - } + if let Ok(mut active) = state.active_port.lock() + && *active == Some(port) + { + *active = None; } }