Skip to content
Merged
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ members = [
"crates/*",
"plugins/*",
]
exclude = ["plugins/cli2", "plugins/db", "plugins/export", "crates/vad-ext"]
exclude = ["plugins/cli2", "plugins/db", "plugins/export", "plugins/extensions", "crates/vad-ext"]

[workspace.dependencies]
hypr-aec = { path = "crates/aec", package = "aec" }
Expand Down
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
16 changes: 3 additions & 13 deletions apps/cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,9 @@ impl App {
let cursor_row = memo_cursor_row.min(lines.len().saturating_sub(1));
let cursor_col = memo_cursor_col.min(current_line_len(lines, cursor_row));

let row_start = if cursor_row + 1 > max_rows {
cursor_row + 1 - max_rows
} else {
0
};
let row_start = (cursor_row + 1).saturating_sub(max_rows);

let col_start = if cursor_col + 1 > max_cols {
cursor_col + 1 - max_cols
} else {
0
};
let col_start = (cursor_col + 1).saturating_sub(max_cols);

let row_end = (row_start + max_rows).min(lines.len());
let lines = lines[row_start..row_end]
Expand Down Expand Up @@ -407,9 +399,7 @@ impl App {
return None;
}

let Some(path) = normalize_pasted_path(&pasted) else {
return None;
};
let path = normalize_pasted_path(&pasted)?;

if !looks_like_audio_file(&path) {
return None;
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/src/audio_drop.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::path::PathBuf;
use std::path::{Path, PathBuf};

pub struct AudioDropRequest {
pub file_path: String,
}

pub fn looks_like_audio_file(path: &PathBuf) -> bool {
pub fn looks_like_audio_file(path: &Path) -> bool {
matches!(
path.extension()
.and_then(|ext| ext.to_str())
Expand Down
12 changes: 6 additions & 6 deletions apps/cli/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ impl EntryApp {
}

if key.code == KeyCode::Enter {
if self.popup_visible {
if let Some(cmd) = self.selected_command_name() {
self.set_input_text(cmd.to_string());
}
if self.popup_visible
&& let Some(cmd) = self.selected_command_name()
{
self.set_input_text(cmd.to_string());
}

let command = self.input_text().trim().to_string();
Expand Down Expand Up @@ -528,12 +528,12 @@ fn single_command_match_score(query: &str, command: &str) -> Option<i32> {
return Some(1);
}

if command.starts_with(&query) {
if command.starts_with(query) {
let penalty = (command.len() as i32 - query.len() as i32).max(0);
return Some(500 - penalty);
}

if let Some(pos) = command.find(&query) {
if let Some(pos) = command.find(query) {
return Some(350 - pos as i32);
}

Expand Down
8 changes: 4 additions & 4 deletions crates/api-nango/src/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ impl NangoConnectionState {
integration_id: &str,
) -> Result<String, NangoConnectionError> {
#[cfg(debug_assertions)]
if let Ok(connection_id) = std::env::var("DEV_NANGO_CONNECTION_ID") {
if !connection_id.is_empty() {
return Ok(connection_id);
}
if let Ok(connection_id) = std::env::var("DEV_NANGO_CONNECTION_ID")
&& !connection_id.is_empty()
{
return Ok(connection_id);
}

let encoded_user_id = urlencoding::encode(user_id);
Expand Down
8 changes: 4 additions & 4 deletions crates/api-subscription/src/routes/billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ where
if let Err(e) = analytics.event(user_id, payload).await {
tracing::warn!("analytics event error: {e}");
}
if let Some(props) = outcome.to_analytics_properties() {
if let Err(e) = analytics.set_properties(user_id, props).await {
tracing::warn!("analytics set_properties error: {e}");
}
if let Some(props) = outcome.to_analytics_properties()
&& let Err(e) = analytics.set_properties(user_id, props).await
{
tracing::warn!("analytics set_properties error: {e}");
}
}
outcome.into_response()
Expand Down
2 changes: 1 addition & 1 deletion crates/segmentation/src/onnx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Segmenter {
}

let has_last_chunk = num_samples < self.window_size
|| (num_samples - self.window_size) % self.window_step_size > 0;
|| !(num_samples - self.window_size).is_multiple_of(self.window_step_size);

if has_last_chunk {
starts.push(num_full_chunks * self.window_step_size);
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,13 +85,13 @@ 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}'"),
});
}
validate_node(child, &child_path, errors);
}
Expand All @@ -100,13 +100,13 @@ fn validate_node(node: &Value, path: &str, errors: &mut Vec<ValidationError>) {
"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}'"),
});
}
validate_node(child, &child_path, errors);
}
Expand All @@ -122,13 +122,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 @@ -145,13 +145,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 @@ -167,13 +167,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 @@ -200,13 +200,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 @@ -223,13 +223,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 @@ -238,13 +238,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
18 changes: 12 additions & 6 deletions plugins/deeplink2/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ pub struct CallbackServerState {
active_port: Mutex<Option<u16>>,
}

impl CallbackServerState {
pub fn new() -> Self {
impl Default for CallbackServerState {
fn default() -> Self {
Self {
servers: Mutex::new(HashMap::new()),
active_port: Mutex::new(None),
}
}
}

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

pub fn render_html(deep_link: &DeepLink, scheme: &str) -> String {
let (is_success, title, description) = ui_content(deep_link);
render_template_html(scheme, is_success, title, description)
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
2 changes: 1 addition & 1 deletion plugins/local-llm/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<R: Runtime> ModelDownloaderRuntime<crate::SupportedModel> for TauriModelRun
};

let send_result = channel.send(progress);
let is_terminal = progress < 0 || progress >= 100;
let is_terminal = !(0..100).contains(&progress);
if send_result.is_err() || is_terminal {
guard.remove(&key);
}
Expand Down