Skip to content

Commit

Permalink
remove dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
m00nwtchr committed Jul 31, 2024
1 parent b5dcdcf commit 4a45a31
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 28 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ cofd = { git = "https://github.com/m00nwtchr/cofd.git" }
#codex-scraper = { git = "https://github.com/m00nwtchr/cofd-miner.git" }

closure = "0.3"
lazy_static = "1"
cfg-if = "1"
itertools = "0.13"
once_cell = "1.4"

anyhow = "1"
log = "0.4"

Expand Down
2 changes: 1 addition & 1 deletion src/component/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl IntegrityComponent {
fl!("touchstones"),
Some(10),
Some(10),
character.touchstones.clone() as Vec<String>,
character.touchstones.clone(),
|i, val| {
text_input("", &val.unwrap_or_default())
.on_input(move |val| Message::TouchstoneChanged(i, val))
Expand Down
15 changes: 6 additions & 9 deletions src/component/skills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,11 @@ impl SkillsComponent {
);
}

let specialties = if let Some(specialties) = character.specialties.get(&skill) {
specialties
} else {
lazy_static::lazy_static! {
static ref DEFAULT: Vec<String> = vec![];
}
&DEFAULT
};
let specialties = character
.specialties
.get(&skill)
.cloned()
.unwrap_or_default();

col1 = col1.push(
button(text(skill.translated()).style(if specialties.is_empty() {
Expand Down Expand Up @@ -158,7 +155,7 @@ impl SkillsComponent {
String::new(),
Some(specialties.len() + 1),
None,
specialties.clone(),
specialties,
move |i, val| {
text_input("", &val.unwrap_or_default())
.on_input(move |val| Message::Specialty(skill, i, val))
Expand Down
17 changes: 5 additions & 12 deletions src/i18n.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::i18n;
use cfg_if::cfg_if;
use cofd::prelude::{Template, VariantName};
use cofd::splat::ability::Ability;
use cofd::splat::changeling::Regalia;
Expand All @@ -18,7 +16,7 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, LanguageRequester, Localizer,
};
use once_cell::sync::{Lazy, OnceCell};
use once_cell::sync::Lazy;
use rust_embed::RustEmbed;
use std::fmt::Display;
use std::ops::Deref;
Expand Down Expand Up @@ -77,15 +75,10 @@ pub fn setup() -> anyhow::Result<Box<dyn LanguageRequester<'static>>> {
let localizer: Arc<dyn Localizer> =
Arc::new(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations));

Check warning on line 76 in src/i18n.rs

View workflow job for this annotation

GitHub Actions / clippy

usage of an `Arc` that is not `Send` and `Sync`

warning: usage of an `Arc` that is not `Send` and `Sync` --> src/i18n.rs:76:3 | 76 | Arc::new(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `Arc<DefaultLocalizer<'_>>` is not `Send` and `Sync` as `DefaultLocalizer<'_>` is neither `Send` nor `Sync` = help: if the `Arc` will not used be across threads replace it with an `Rc` = help: otherwise make `DefaultLocalizer<'_>` `Send` and `Sync` or consider a wrapper type such as `Mutex` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync = note: `#[warn(clippy::arc_with_non_send_sync)]` on by default

let mut language_requester = Box::new({
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
i18n_embed::WebLanguageRequester::new()
} else {
i18n_embed::DesktopLanguageRequester::new()
}
}
});
#[cfg(not(target_arch = "wasm32"))]
let mut language_requester = Box::new(i18n_embed::DesktopLanguageRequester::new());
#[cfg(target_arch = "wasm32")]
let mut language_requester = Box::new(i18n_embed::WebLanguageRequester::new());

language_requester.add_listener(Arc::downgrade(&localizer));
language_requester.poll()?;
Expand Down

0 comments on commit 4a45a31

Please sign in to comment.