forked from 1b-agent/opencadstudio-upstream
chore(lints): fix compiler warnings and clippy array suggestions
This commit is contained in:
1 parent
66fccc217e
commit
531ba44faa
5 files changed
+30
-25
No files matched your search
@@ -389,7 +389,7 @@ impl OpenCADStudio {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::app::settings::RightClickMode;
|
||||
use crate::command::{CadCommand, StepInput};
|
||||
use crate::command::StepInput;
|
||||
use crate::ui::popup::context_menu::MenuAction;
|
||||
use glam::DVec3;
|
||||
use iced::Point;
|
||||
|
||||
+25
-20
@@ -1,7 +1,7 @@
|
||||
//! Application language selection and embedded Fluent resources.
|
||||
|
||||
use i18n_embed::fluent::{fluent_language_loader, FluentLanguageLoader};
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[cfg(all(not(target_arch = "wasm32"), not(test)))]
|
||||
use i18n_embed::DesktopLanguageRequester;
|
||||
use i18n_embed::LanguageLoader;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
@@ -163,27 +163,32 @@ fn system_languages() -> Vec<i18n_embed::unic_langid::LanguageIdentifier> {
|
||||
// for the system language, so the machine's locale must never reach
|
||||
// them — not even from a test that runs in parallel.
|
||||
#[cfg(test)]
|
||||
return vec!["en-US".parse().expect("en-US is a valid language identifier")];
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let mut requested = WebLanguageRequester::requested_languages();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let requested = DesktopLanguageRequester::requested_languages();
|
||||
|
||||
// `navigator.languages` may be empty in privacy-restricted browser
|
||||
// contexts. The singular preference is still exposed by mainstream
|
||||
// browsers, so keep it as the first fallback before English.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
if requested.is_empty() {
|
||||
if let Some(language) = web_sys::window()
|
||||
.and_then(|window| window.navigator().language())
|
||||
.and_then(|language| language.parse().ok())
|
||||
{
|
||||
requested.push(language);
|
||||
}
|
||||
{
|
||||
vec!["en-US".parse().expect("en-US is a valid language identifier")]
|
||||
}
|
||||
|
||||
requested
|
||||
#[cfg(not(test))]
|
||||
{
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let mut requested = WebLanguageRequester::requested_languages();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let requested = DesktopLanguageRequester::requested_languages();
|
||||
|
||||
// `navigator.languages` may be empty in privacy-restricted browser
|
||||
// contexts. The singular preference is still exposed by mainstream
|
||||
// browsers, so keep it as the first fallback before English.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
if requested.is_empty() {
|
||||
if let Some(language) = web_sys::window()
|
||||
.and_then(|window| window.navigator().language())
|
||||
.and_then(|language| language.parse().ok())
|
||||
{
|
||||
requested.push(language);
|
||||
}
|
||||
}
|
||||
|
||||
requested
|
||||
}
|
||||
}
|
||||
|
||||
fn load_language(
|
||||
|
||||
@@ -2411,7 +2411,7 @@ mod tests {
|
||||
assert_eq!(keywords(&command), ["P", "R"]);
|
||||
// The host hands the restored document back; the cache follows it.
|
||||
let mut doc = acadrust::CadDocument::new();
|
||||
doc.add_entity(line(0.0, 0.0, 20.0, 0.0, 7));
|
||||
let _ = doc.add_entity(line(0.0, 0.0, 20.0, 0.0, 7));
|
||||
command.on_document_undone(&doc);
|
||||
assert_eq!(command.all_entities.len(), 1);
|
||||
assert_eq!(command.all_entities[0].common().handle, Handle::new(7));
|
||||
|
||||
+1
-1
@@ -13507,7 +13507,7 @@ mod layout_cache_tests {
|
||||
|
||||
#[test]
|
||||
fn cached_layout_names_returns_same_arc_until_bump() {
|
||||
let mut scene = Scene::new();
|
||||
let scene = Scene::new();
|
||||
let first = scene.cached_layout_names();
|
||||
let second = scene.cached_layout_names();
|
||||
assert!(std::sync::Arc::ptr_eq(&first, &second));
|
||||
|
||||
@@ -5949,7 +5949,7 @@ mod highlight_classification_tests {
|
||||
|
||||
#[test]
|
||||
fn each_wire_lands_in_the_bucket_the_old_predicate_chose() {
|
||||
let wires = vec![plain("1"), circle("2"), ellipse("3"), plain("4")];
|
||||
let wires = [plain("1"), circle("2"), ellipse("3"), plain("4")];
|
||||
let refs: Vec<&WireModel> = wires.iter().collect();
|
||||
let depth_map = rustc_hash::FxHashMap::default();
|
||||
|
||||
@@ -5979,7 +5979,7 @@ mod highlight_classification_tests {
|
||||
// reach the instances.
|
||||
#[test]
|
||||
fn the_colour_override_reaches_the_instances() {
|
||||
let wires = vec![circle("2"), ellipse("3")];
|
||||
let wires = [circle("2"), ellipse("3")];
|
||||
let refs: Vec<&WireModel> = wires.iter().collect();
|
||||
let depth_map = rustc_hash::FxHashMap::default();
|
||||
|
||||
|
||||
Reference in new issue
Block a user