Improved Rust syntax by Clippy suggestions (#765)
Some checks are pending
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer 2026-05-16 18:53:53 +02:00 committed by GitHub
parent 91cfe8dcd0
commit 9419c4ed44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 51 additions and 67 deletions

View File

@ -245,10 +245,8 @@ fn should_open_in_system_browser<R: tauri::Runtime>(webview: &tauri::Webview<R>,
}
}
if let Ok(current_url) = webview.url() {
if same_origin(&current_url, url) {
return false;
}
if let Ok(current_url) = webview.url() && same_origin(&current_url, url) {
return false;
}
!is_local_host(url.host_str())
@ -415,10 +413,8 @@ pub async fn change_location_to(url: &str) {
}
}
if let Ok(parsed_url) = tauri::Url::parse(url) {
if is_local_http_url(&parsed_url) {
*APPROVED_APP_URL.lock().unwrap() = Some(parsed_url);
}
if let Ok(parsed_url) = tauri::Url::parse(url) && is_local_http_url(&parsed_url) {
*APPROVED_APP_URL.lock().unwrap() = Some(parsed_url);
}
let js_location_change = format!("window.location = '{url}';");
@ -685,12 +681,10 @@ pub async fn register_shortcut(_token: APIToken, payload: Json<RegisterShortcutR
let mut registered_shortcuts = REGISTERED_SHORTCUTS.lock().unwrap();
// Unregister the old shortcut if one exists for this name:
if let Some(old_shortcut) = registered_shortcuts.get(&id) {
if !old_shortcut.is_empty() {
match shortcut_manager.unregister(old_shortcut.as_str()) {
Ok(_) => info!(Source = "Tauri"; "Unregistered old shortcut '{old_shortcut}' for '{}'.", id),
Err(error) => warn!(Source = "Tauri"; "Failed to unregister old shortcut '{old_shortcut}': {error}"),
}
if let Some(old_shortcut) = registered_shortcuts.get(&id) && !old_shortcut.is_empty() {
match shortcut_manager.unregister(old_shortcut.as_str()) {
Ok(_) => info!(Source = "Tauri"; "Unregistered old shortcut '{old_shortcut}' for '{}'.", id),
Err(error) => warn!(Source = "Tauri"; "Failed to unregister old shortcut '{old_shortcut}': {error}"),
}
}

View File

@ -87,10 +87,8 @@ fn normalize_locale_tag(locale: &str) -> Option<String> {
return None;
}
if let Some(region) = segments.next() {
if region.len() == 2 && region.chars().all(|c| c.is_ascii_alphabetic()) {
return Some(format!("{}-{}", language, region.to_ascii_uppercase()));
}
if let Some(region) = segments.next() && region.len() == 2 && region.chars().all(|c| c.is_ascii_alphabetic()) {
return Some(format!("{}-{}", language, region.to_ascii_uppercase()));
}
Some(language)
@ -418,10 +416,9 @@ fn load_policy_values_from_directories(directories: &[PathBuf]) -> HashMap<Strin
}
let secret_path = directory.join(ENTERPRISE_POLICY_SECRET_FILE_NAME);
if let Some(secret_values) = read_policy_yaml_mapping(&secret_path) {
if let Some(secret) = secret_values.get("config_encryption_secret") {
insert_first_non_empty_value(&mut values, "config_encryption_secret", secret);
}
if let Some(secret_values) = read_policy_yaml_mapping(&secret_path)
&& let Some(secret) = secret_values.get("config_encryption_secret") {
insert_first_non_empty_value(&mut values, "config_encryption_secret", secret);
}
}

View File

@ -119,18 +119,17 @@ impl PandocProcessBuilder {
let local_installation_root_directory = data_folder.join("pandoc");
let executable_name = Self::pandoc_executable_name();
if local_installation_root_directory.exists() {
if let Ok(pandoc_path) = Self::find_executable_in_dir(&local_installation_root_directory, &executable_name) {
HAS_LOGGED_PANDOC_PATH.get_or_init(|| {
info!(Source = "PandocProcessBuilder"; "Found local Pandoc installation at: '{}'.", pandoc_path.to_string_lossy()
);
});
if local_installation_root_directory.exists()
&& let Ok(pandoc_path) = Self::find_executable_in_dir(&local_installation_root_directory, &executable_name) {
HAS_LOGGED_PANDOC_PATH.get_or_init(|| {
info!(Source = "PandocProcessBuilder"; "Found local Pandoc installation at: '{}'.", pandoc_path.to_string_lossy()
);
});
return PandocExecutable {
executable: pandoc_path.to_string_lossy().to_string(),
is_local_installation: true,
};
}
return PandocExecutable {
executable: pandoc_path.to_string_lossy().to_string(),
is_local_installation: true,
};
}
for candidate in Self::system_pandoc_executable_candidates(&executable_name) {
@ -168,10 +167,8 @@ impl PandocProcessBuilder {
if let Ok(entries) = fs::read_dir(dir) {
for entry in entries.flatten() {
let path = entry.path();
if path.is_dir() {
if let Ok(found_path) = Self::find_executable_in_dir(&path, executable_name) {
return Ok(found_path);
}
if path.is_dir() && let Ok(found_path) = Self::find_executable_in_dir(&path, executable_name) {
return Ok(found_path);
}
}
}
@ -240,33 +237,31 @@ impl PandocProcessBuilder {
let runtime_os = std::env::consts::OS;
let runtime_arch = std::env::consts::ARCH;
if let Ok(metadata) = META_DATA.lock() {
if let Some(metadata) = metadata.as_ref() {
let metadata_arch = &metadata.architecture;
if let Ok(metadata) = META_DATA.lock() && let Some(metadata) = metadata.as_ref() {
let metadata_arch = &metadata.architecture;
// Determine expected OS from metadata:
let metadata_is_windows = metadata_arch.starts_with("win-");
let metadata_is_macos = metadata_arch.starts_with("osx-");
let metadata_is_linux = metadata_arch.starts_with("linux-");
// Determine expected OS from metadata:
let metadata_is_windows = metadata_arch.starts_with("win-");
let metadata_is_macos = metadata_arch.starts_with("osx-");
let metadata_is_linux = metadata_arch.starts_with("linux-");
// Compare with runtime OS:
let runtime_is_windows = runtime_os == "windows";
let runtime_is_macos = runtime_os == "macos";
let runtime_is_linux = runtime_os == "linux";
// Compare with runtime OS:
let runtime_is_windows = runtime_os == "windows";
let runtime_is_macos = runtime_os == "macos";
let runtime_is_linux = runtime_os == "linux";
let os_mismatch = (metadata_is_windows != runtime_is_windows)
|| (metadata_is_macos != runtime_is_macos)
|| (metadata_is_linux != runtime_is_linux);
let os_mismatch = (metadata_is_windows != runtime_is_windows)
|| (metadata_is_macos != runtime_is_macos)
|| (metadata_is_linux != runtime_is_linux);
if os_mismatch {
warn!(
Source = "Pandoc";
"Runtime-detected OS '{}-{}' differs from metadata architecture '{}'. Using runtime-detected OS. This is expected on dev machines where metadata.txt may be outdated.",
runtime_os,
runtime_arch,
metadata_arch
);
}
if os_mismatch {
warn!(
Source = "Pandoc";
"Runtime-detected OS '{}-{}' differs from metadata architecture '{}'. Using runtime-detected OS. This is expected on dev machines where metadata.txt may be outdated.",
runtime_os,
runtime_arch,
metadata_arch
);
}
}
});

View File

@ -100,12 +100,10 @@ pub async fn qdrant_port(_token: APIToken) -> Json<ProvideQdrantInfo> {
/// Starts the Qdrant server in a separate process.
pub fn start_qdrant_server<R: tauri::Runtime>(app_handle: tauri::AppHandle<R>){
let path = qdrant_base_path();
if !path.exists() {
if let Err(e) = fs::create_dir_all(&path){
error!(Source="Qdrant"; "The required directory to host the Qdrant database could not be created: {}", e);
set_qdrant_unavailable(format!("The Qdrant data directory could not be created: {e}"));
return;
};
if !path.exists() && let Err(e) = fs::create_dir_all(&path){
error!(Source="Qdrant"; "The required directory to host the Qdrant database could not be created: {}", e);
set_qdrant_unavailable(format!("The Qdrant data directory could not be created: {e}"));
return;
}
let (cert_path, key_path) = match create_temp_tls_files(&path) {

View File

@ -50,7 +50,7 @@ pub fn kill_stale_process(pid_file_path: PathBuf, sidecar_type: SidecarType) ->
let killed = process.kill_with(Signal::Kill).unwrap_or_else(|| process.kill());
if !killed {
return Err(Error::new(ErrorKind::Other, "Failed to kill process"));
return Err(Error::other("Failed to kill process"));
}
info!(Source="Stale Process Cleanup";"{}: Killed process: \"{}\"", sidecar_type,pid_file_path.display());
} else {