Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions crates/template-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro_rules! common_derives {
common_derives! {
pub enum Template {
EnhanceSystem(EnhanceSystem),
EnhanceUser(EnhanceUser),
EnhanceUser(Box<EnhanceUser>),
TitleSystem(TitleSystem),
TitleUser(TitleUser),
ChatSystem(ChatSystem),
Expand All @@ -46,7 +46,7 @@ pub enum Error {
pub fn render(t: Template) -> Result<String, Error> {
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),
Expand Down
126 changes: 63 additions & 63 deletions crates/tiptap/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -85,27 +85,27 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
"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}'"),
});
}
}
}

"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}'"),
});
}
}
}
Expand All @@ -120,13 +120,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -143,13 +143,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -165,13 +165,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -198,13 +198,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -221,13 +221,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
}
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);
}
Expand All @@ -236,13 +236,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
"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}'"),
});
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions plugins/deeplink2/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ pub struct CallbackServerState {
active_port: Mutex<Option<u16>>,
}

impl Default for CallbackServerState {
fn default() -> Self {
Self::new()
}
}

impl CallbackServerState {
pub fn new() -> Self {
Self {
Expand Down Expand Up @@ -196,10 +202,10 @@ async fn serve<R: tauri::Runtime>(
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;
}
}

Expand Down
Loading