Skip to content

Bump deps and prep for release #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 21, 2025
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: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[resolver]
incompatible-rust-versions = "fallback"
25 changes: 24 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,37 @@ fluent-langneg = "0.13"
futures = "0.3"
iai = "0.1"
intl_pluralrules = "7.0"
once_cell = "1.21"
rustc-hash = "2"
serde = "1.0"
serde_json = "1.0"
thiserror = "2.0"
tokio = "1.0"
tokio = "1.38"
unic-langid = "0.9"

fluent-bundle = { version = "0.15.3", path = "fluent-bundle" }
fluent-fallback = { version = "0.7.1", path = "fluent-fallback" }
fluent-pseudo = { version = "0.3.2", path = "fluent-pseudo" }
fluent-syntax = { version = "0.11.1", path = "fluent-syntax" }
intl-memoizer = { version = "0.5.2", path = "intl-memoizer" }

[workspace.metadata.typos.default]
locale = "en-us"
extend-ignore-re = [
"(?s)(#|//|/\\*)\\s*typos: ignore start.*?\\n\\s*(#|//|/\\*)\\s*typos: ignore end",
]

[workspace.metadata.typos.default.extend-words]
travelled = "travelled" # sadly part of a public API and fixing would be a breaking change
nd = "nd" # appears frequently in inline test messages

[workspace.metadata.typos.files]
ignore-hidden = false
extend-exclude = [
"/.git",
"fluent-bundle/benches/**/*.ftl",
"fluent-bundle/examples/**/*.ftl",
"fluent-syntax/tests/fixtures/**/*.ftl",
"fluent-syntax/tests/fixtures/**/*.json",
"fluent-testing/resources/**/*.ftl",
]
9 changes: 8 additions & 1 deletion fluent-bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Changelog

## Unreleased
- Bump `self_cell` to 1.x
- Implement NUMBER builtin
- Improve examples
- Refactor to remove unnecessary named lifetimes
- Cleanup docs
- Satiate Clippy
- Bump `smallvec` to 1.13
- Bump `rand` to 0.9
- Bump `self_cell` to 1.2
- Bump `serde_yaml` to 0.9

## fluent-bundle 0.15.3 (March 16, 2024)
Expand Down
6 changes: 3 additions & 3 deletions fluent-bundle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ fluent-syntax.workspace = true
intl_pluralrules.workspace = true
rustc-hash.workspace = true
unic-langid.workspace = true
intl-memoizer = { version = "0.5.2", path = "../intl-memoizer" }
self_cell = "1.0"
intl-memoizer.workspace = true
self_cell = "1.2"
smallvec = "1.13"

[dev-dependencies]
criterion.workspace = true
iai.workspace = true
serde = { workspace = true, features = ["derive"] }
unic-langid = { workspace = true, features = ["macros"] }
rand = "0.8"
rand = "0.9"
serde_yaml = "0.9"

[features]
Expand Down
8 changes: 4 additions & 4 deletions fluent-bundle/examples/custom_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// Lastly, we'll also create a new formatter which will be memoizable.
//
// The type and its options are modelled after ECMA402 Intl.DateTimeFormat.
// The type and its options are modeled after ECMA402 Intl.DateTimeFormat.
use intl_memoizer::Memoizable;
use unic_langid::LanguageIdentifier;

Expand All @@ -21,7 +21,7 @@ use fluent_bundle::{FluentArgs, FluentBundle, FluentResource, FluentValue};
// - timeStyle
//
// with an enum of allowed values.
#[derive(Debug, Default, PartialEq, Eq, Clone, Hash)]
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)]
enum DateTimeStyleValue {
Full,
Long,
Expand Down Expand Up @@ -49,7 +49,7 @@ impl From<&FluentValue<'_>> for DateTimeStyleValue {
}
}

#[derive(Debug, PartialEq, Eq, Default, Clone, Hash)]
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)]
struct DateTimeOptions {
pub date_style: DateTimeStyleValue,
pub time_style: DateTimeStyleValue,
Expand Down Expand Up @@ -84,7 +84,7 @@ impl From<&FluentArgs<'_>> for DateTimeOptions {
// Our new custom type will store a value as an epoch number,
// and the options.

#[derive(Debug, PartialEq, Clone)]
#[derive(Clone, Debug, PartialEq)]
struct DateTime {
epoch: usize,
options: DateTimeOptions,
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::resolver::ResolverError;
use fluent_syntax::parser::ParserError;
use std::error::Error;

#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum EntryKind {
Message,
Term,
Expand All @@ -23,7 +23,7 @@ impl std::fmt::Display for EntryKind {
///
/// It contains three main types of errors that may come up
/// during runtime use of the fluent-bundle crate.
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum FluentError {
/// An error which occurs when
/// [`FluentBundle::add_resource`](crate::bundle::FluentBundle::add_resource)
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/src/resolver/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::error::Error;
/// Maps an [`InlineExpression`] into the kind of reference, with owned strings
/// that identify the expression. This makes it so that the [`InlineExpression`] can
/// be used to generate an error string.
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ReferenceKind {
Function {
id: String,
Expand Down Expand Up @@ -49,7 +49,7 @@ where

/// Errors generated during the process of resolving a fluent message into a string.
/// This process takes place in the `write` method of the `WriteValue` trait.
#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ResolverError {
Reference(ReferenceKind),
NoValue(String),
Expand Down
10 changes: 5 additions & 5 deletions fluent-bundle/src/types/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use intl_pluralrules::operands::PluralOperands;
use crate::args::FluentArgs;
use crate::types::FluentValue;

#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
pub enum FluentNumberType {
#[default]
Cardinal,
Expand All @@ -25,7 +25,7 @@ impl From<&str> for FluentNumberType {
}
}

#[derive(Debug, Copy, Clone, Default, Hash, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
pub enum FluentNumberStyle {
#[default]
Decimal,
Expand All @@ -44,7 +44,7 @@ impl From<&str> for FluentNumberStyle {
}
}

#[derive(Debug, Copy, Clone, Default, Hash, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
pub enum FluentNumberCurrencyDisplayStyle {
#[default]
Symbol,
Expand All @@ -63,7 +63,7 @@ impl From<&str> for FluentNumberCurrencyDisplayStyle {
}
}

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct FluentNumberOptions {
pub r#type: FluentNumberType,
pub style: FluentNumberStyle,
Expand Down Expand Up @@ -134,7 +134,7 @@ impl FluentNumberOptions {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Clone, Debug, PartialEq)]
pub struct FluentNumber {
pub value: f64,
pub options: FluentNumberOptions,
Expand Down
2 changes: 2 additions & 0 deletions fluent-bundle/tests/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use fluent_syntax::ast::Pattern;
#[test]
fn test_builtin_number() {
// 1. Create bundle
// typos: ignore start
let ftl_string = String::from(
r#"
count = { NUMBER($num, type: "cardinal") ->
Expand All @@ -17,6 +18,7 @@ order = { NUMBER($num, type: "ordinal") ->
[few] {$num}rd
}
"#,
// typos: ignore end
);

let mut bundle = FluentBundle::default();
Expand Down
6 changes: 3 additions & 3 deletions fluent-bundle/tests/custom_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn fluent_custom_type() {

#[test]
fn fluent_date_time_builtin() {
#[derive(Debug, Default, PartialEq, Clone)]
#[derive(Clone, Debug, Default, PartialEq)]
enum DateTimeStyleValue {
Full,
Long,
Expand All @@ -73,7 +73,7 @@ fn fluent_date_time_builtin() {
}
}

#[derive(Debug, PartialEq, Default, Clone)]
#[derive(Clone, Debug, Default, PartialEq)]
struct DateTimeOptions {
pub date_style: DateTimeStyleValue,
pub time_style: DateTimeStyleValue,
Expand All @@ -99,7 +99,7 @@ fn fluent_date_time_builtin() {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Clone, Debug, PartialEq)]
struct DateTime {
epoch: usize,
options: DateTimeOptions,
Expand Down
22 changes: 11 additions & 11 deletions fluent-bundle/tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn get_defaults(path: &str) -> Result<TestDefaults, io::Error> {
Ok(serde_yaml::from_str(&s).expect("Parsing YAML failed."))
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestBundle {
pub name: Option<String>,
Expand All @@ -102,7 +102,7 @@ pub struct TestBundle {
pub errors: Vec<TestError>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestResource {
pub name: Option<String>,
Expand All @@ -111,7 +111,7 @@ pub struct TestResource {
pub source: String,
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestSetup {
#[serde(skip_serializing_if = "Vec::is_empty", default)]
Expand All @@ -120,23 +120,23 @@ pub struct TestSetup {
pub resources: Vec<TestResource>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestError {
#[serde(rename = "type")]
pub error_type: String,
pub desc: Option<String>,
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
pub enum TestArgumentValue {
String(String),
Number(f64),
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestAssert {
pub bundle: Option<String>,
Expand All @@ -149,7 +149,7 @@ pub struct TestAssert {
pub missing: Option<bool>,
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Test {
pub name: String,
Expand All @@ -163,7 +163,7 @@ pub struct Test {
pub asserts: Vec<TestAssert>,
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestSuite {
pub name: String,
Expand All @@ -180,13 +180,13 @@ pub struct TestSuite {
pub suites: Vec<TestSuite>,
}

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestFixture {
pub suites: Vec<TestSuite>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BundleDefaults {
#[serde(rename = "useIsolating")]
Expand All @@ -195,7 +195,7 @@ pub struct BundleDefaults {
pub locales: Option<Vec<String>>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(deny_unknown_fields)]
pub struct TestDefaults {
pub bundle: BundleDefaults,
Expand Down
6 changes: 3 additions & 3 deletions fluent-bundle/tests/resolver_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use fluent_bundle::resolver::ResolverError;
use fluent_bundle::FluentArgs;
use fluent_bundle::FluentError;
use fluent_bundle::{FluentBundle, FluentResource, FluentValue};
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::distr::Alphanumeric;
use rand::{rng, Rng};
use unic_langid::LanguageIdentifier;

use helpers::*;
Expand Down Expand Up @@ -72,7 +72,7 @@ impl Scope {
}

fn generate_random_hash() -> String {
let mut rng = thread_rng();
let mut rng = rng();
let chars: String = iter::repeat(())
.map(|()| rng.sample(Alphanumeric))
.map(char::from)
Expand Down
6 changes: 4 additions & 2 deletions fluent-fallback/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog

## Unreleased

- …
- Refactor to remove unnecessary named lifetimes
- Cleanup docs
- Satiate Clippy
- Bump `once_cell` to 1.21

## fluent-fallback 0.7.1 (March 16, 2024)
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rustc-hash.workspace = true
unic-langid.workspace = true
async-trait = "0.1"
chunky-vec = "0.1"
once_cell = "1.19"
once_cell.workspace = true
pin-cell = "0.2"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/examples/simple-fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use rustc_hash::FxHashSet;
use unic_langid::{langid, LanguageIdentifier};

/// This helper struct holds the scheme for converting
/// resource paths into full paths. It is used to customise
/// resource paths into full paths. It is used to customize
/// `fluent-fallback::SyncLocalization`.
struct Bundles {
res_path_scheme: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use fluent_bundle::FluentError;
use std::error::Error;
use unic_langid::LanguageIdentifier;

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, Eq, PartialEq)]
pub enum LocalizationError {
Bundle {
error: FluentError,
Expand Down
Loading