Skip to content

Commit 4b6f26d

Browse files
authored
Merge pull request #382 from alerque/release-prep
2 parents 10302d0 + cd5c60c commit 4b6f26d

32 files changed

+125
-90
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[resolver]
2+
incompatible-rust-versions = "fallback"

Cargo.toml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,37 @@ fluent-langneg = "0.13"
3636
futures = "0.3"
3737
iai = "0.1"
3838
intl_pluralrules = "7.0"
39+
once_cell = "1.21"
3940
rustc-hash = "2"
4041
serde = "1.0"
4142
serde_json = "1.0"
4243
thiserror = "2.0"
43-
tokio = "1.0"
44+
tokio = "1.38"
4445
unic-langid = "0.9"
4546

4647
fluent-bundle = { version = "0.15.3", path = "fluent-bundle" }
4748
fluent-fallback = { version = "0.7.1", path = "fluent-fallback" }
4849
fluent-pseudo = { version = "0.3.2", path = "fluent-pseudo" }
4950
fluent-syntax = { version = "0.11.1", path = "fluent-syntax" }
51+
intl-memoizer = { version = "0.5.2", path = "intl-memoizer" }
52+
53+
[workspace.metadata.typos.default]
54+
locale = "en-us"
55+
extend-ignore-re = [
56+
"(?s)(#|//|/\\*)\\s*typos: ignore start.*?\\n\\s*(#|//|/\\*)\\s*typos: ignore end",
57+
]
58+
59+
[workspace.metadata.typos.default.extend-words]
60+
travelled = "travelled" # sadly part of a public API and fixing would be a breaking change
61+
nd = "nd" # appears frequently in inline test messages
62+
63+
[workspace.metadata.typos.files]
64+
ignore-hidden = false
65+
extend-exclude = [
66+
"/.git",
67+
"fluent-bundle/benches/**/*.ftl",
68+
"fluent-bundle/examples/**/*.ftl",
69+
"fluent-syntax/tests/fixtures/**/*.ftl",
70+
"fluent-syntax/tests/fixtures/**/*.json",
71+
"fluent-testing/resources/**/*.ftl",
72+
]

fluent-bundle/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Changelog
22

33
## Unreleased
4-
- Bump `self_cell` to 1.x
4+
- Implement NUMBER builtin
5+
- Improve examples
6+
- Refactor to remove unnecessary named lifetimes
7+
- Cleanup docs
8+
- Satiate Clippy
9+
- Bump `smallvec` to 1.13
10+
- Bump `rand` to 0.9
11+
- Bump `self_cell` to 1.2
512
- Bump `serde_yaml` to 0.9
613

714
## fluent-bundle 0.15.3 (March 16, 2024)

fluent-bundle/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ fluent-syntax.workspace = true
2929
intl_pluralrules.workspace = true
3030
rustc-hash.workspace = true
3131
unic-langid.workspace = true
32-
intl-memoizer = { version = "0.5.2", path = "../intl-memoizer" }
33-
self_cell = "1.0"
32+
intl-memoizer.workspace = true
33+
self_cell = "1.2"
3434
smallvec = "1.13"
3535

3636
[dev-dependencies]
3737
criterion.workspace = true
3838
iai.workspace = true
3939
serde = { workspace = true, features = ["derive"] }
4040
unic-langid = { workspace = true, features = ["macros"] }
41-
rand = "0.8"
41+
rand = "0.9"
4242
serde_yaml = "0.9"
4343

4444
[features]

fluent-bundle/examples/custom_type.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// Lastly, we'll also create a new formatter which will be memoizable.
1010
//
11-
// The type and its options are modelled after ECMA402 Intl.DateTimeFormat.
11+
// The type and its options are modeled after ECMA402 Intl.DateTimeFormat.
1212
use intl_memoizer::Memoizable;
1313
use unic_langid::LanguageIdentifier;
1414

@@ -21,7 +21,7 @@ use fluent_bundle::{FluentArgs, FluentBundle, FluentResource, FluentValue};
2121
// - timeStyle
2222
//
2323
// with an enum of allowed values.
24-
#[derive(Debug, Default, PartialEq, Eq, Clone, Hash)]
24+
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)]
2525
enum DateTimeStyleValue {
2626
Full,
2727
Long,
@@ -49,7 +49,7 @@ impl From<&FluentValue<'_>> for DateTimeStyleValue {
4949
}
5050
}
5151

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

87-
#[derive(Debug, PartialEq, Clone)]
87+
#[derive(Clone, Debug, PartialEq)]
8888
struct DateTime {
8989
epoch: usize,
9090
options: DateTimeOptions,

fluent-bundle/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::resolver::ResolverError;
22
use fluent_syntax::parser::ParserError;
33
use std::error::Error;
44

5-
#[derive(Debug, PartialEq, Eq, Clone)]
5+
#[derive(Clone, Debug, Eq, PartialEq)]
66
pub enum EntryKind {
77
Message,
88
Term,
@@ -23,7 +23,7 @@ impl std::fmt::Display for EntryKind {
2323
///
2424
/// It contains three main types of errors that may come up
2525
/// during runtime use of the fluent-bundle crate.
26-
#[derive(Debug, PartialEq, Eq, Clone)]
26+
#[derive(Clone, Debug, Eq, PartialEq)]
2727
pub enum FluentError {
2828
/// An error which occurs when
2929
/// [`FluentBundle::add_resource`](crate::bundle::FluentBundle::add_resource)

fluent-bundle/src/resolver/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::error::Error;
44
/// Maps an [`InlineExpression`] into the kind of reference, with owned strings
55
/// that identify the expression. This makes it so that the [`InlineExpression`] can
66
/// be used to generate an error string.
7-
#[derive(Debug, PartialEq, Eq, Clone)]
7+
#[derive(Clone, Debug, Eq, PartialEq)]
88
pub enum ReferenceKind {
99
Function {
1010
id: String,
@@ -49,7 +49,7 @@ where
4949

5050
/// Errors generated during the process of resolving a fluent message into a string.
5151
/// This process takes place in the `write` method of the `WriteValue` trait.
52-
#[derive(Debug, PartialEq, Eq, Clone)]
52+
#[derive(Clone, Debug, Eq, PartialEq)]
5353
pub enum ResolverError {
5454
Reference(ReferenceKind),
5555
NoValue(String),

fluent-bundle/src/types/number.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use intl_pluralrules::operands::PluralOperands;
88
use crate::args::FluentArgs;
99
use crate::types::FluentValue;
1010

11-
#[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)]
11+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
1212
pub enum FluentNumberType {
1313
#[default]
1414
Cardinal,
@@ -25,7 +25,7 @@ impl From<&str> for FluentNumberType {
2525
}
2626
}
2727

28-
#[derive(Debug, Copy, Clone, Default, Hash, PartialEq, Eq)]
28+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
2929
pub enum FluentNumberStyle {
3030
#[default]
3131
Decimal,
@@ -44,7 +44,7 @@ impl From<&str> for FluentNumberStyle {
4444
}
4545
}
4646

47-
#[derive(Debug, Copy, Clone, Default, Hash, PartialEq, Eq)]
47+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
4848
pub enum FluentNumberCurrencyDisplayStyle {
4949
#[default]
5050
Symbol,
@@ -63,7 +63,7 @@ impl From<&str> for FluentNumberCurrencyDisplayStyle {
6363
}
6464
}
6565

66-
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
66+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
6767
pub struct FluentNumberOptions {
6868
pub r#type: FluentNumberType,
6969
pub style: FluentNumberStyle,
@@ -134,7 +134,7 @@ impl FluentNumberOptions {
134134
}
135135
}
136136

137-
#[derive(Debug, PartialEq, Clone)]
137+
#[derive(Clone, Debug, PartialEq)]
138138
pub struct FluentNumber {
139139
pub value: f64,
140140
pub options: FluentNumberOptions,

fluent-bundle/tests/builtins.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use fluent_syntax::ast::Pattern;
44
#[test]
55
fn test_builtin_number() {
66
// 1. Create bundle
7+
// typos: ignore start
78
let ftl_string = String::from(
89
r#"
910
count = { NUMBER($num, type: "cardinal") ->
@@ -17,6 +18,7 @@ order = { NUMBER($num, type: "ordinal") ->
1718
[few] {$num}rd
1819
}
1920
"#,
21+
// typos: ignore end
2022
);
2123

2224
let mut bundle = FluentBundle::default();

fluent-bundle/tests/custom_types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn fluent_custom_type() {
4747

4848
#[test]
4949
fn fluent_date_time_builtin() {
50-
#[derive(Debug, Default, PartialEq, Clone)]
50+
#[derive(Clone, Debug, Default, PartialEq)]
5151
enum DateTimeStyleValue {
5252
Full,
5353
Long,
@@ -73,7 +73,7 @@ fn fluent_date_time_builtin() {
7373
}
7474
}
7575

76-
#[derive(Debug, PartialEq, Default, Clone)]
76+
#[derive(Clone, Debug, Default, PartialEq)]
7777
struct DateTimeOptions {
7878
pub date_style: DateTimeStyleValue,
7979
pub time_style: DateTimeStyleValue,
@@ -99,7 +99,7 @@ fn fluent_date_time_builtin() {
9999
}
100100
}
101101

102-
#[derive(Debug, PartialEq, Clone)]
102+
#[derive(Clone, Debug, PartialEq)]
103103
struct DateTime {
104104
epoch: usize,
105105
options: DateTimeOptions,

fluent-bundle/tests/helpers/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn get_defaults(path: &str) -> Result<TestDefaults, io::Error> {
8888
Ok(serde_yaml::from_str(&s).expect("Parsing YAML failed."))
8989
}
9090

91-
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
91+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
9292
#[serde(deny_unknown_fields)]
9393
pub struct TestBundle {
9494
pub name: Option<String>,
@@ -102,7 +102,7 @@ pub struct TestBundle {
102102
pub errors: Vec<TestError>,
103103
}
104104

105-
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
105+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
106106
#[serde(deny_unknown_fields)]
107107
pub struct TestResource {
108108
pub name: Option<String>,
@@ -111,7 +111,7 @@ pub struct TestResource {
111111
pub source: String,
112112
}
113113

114-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
114+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
115115
#[serde(deny_unknown_fields)]
116116
pub struct TestSetup {
117117
#[serde(skip_serializing_if = "Vec::is_empty", default)]
@@ -120,23 +120,23 @@ pub struct TestSetup {
120120
pub resources: Vec<TestResource>,
121121
}
122122

123-
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
123+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
124124
#[serde(deny_unknown_fields)]
125125
pub struct TestError {
126126
#[serde(rename = "type")]
127127
pub error_type: String,
128128
pub desc: Option<String>,
129129
}
130130

131-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
131+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
132132
#[serde(deny_unknown_fields)]
133133
#[serde(untagged)]
134134
pub enum TestArgumentValue {
135135
String(String),
136136
Number(f64),
137137
}
138138

139-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
139+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
140140
#[serde(deny_unknown_fields)]
141141
pub struct TestAssert {
142142
pub bundle: Option<String>,
@@ -149,7 +149,7 @@ pub struct TestAssert {
149149
pub missing: Option<bool>,
150150
}
151151

152-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
152+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
153153
#[serde(deny_unknown_fields)]
154154
pub struct Test {
155155
pub name: String,
@@ -163,7 +163,7 @@ pub struct Test {
163163
pub asserts: Vec<TestAssert>,
164164
}
165165

166-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
166+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
167167
#[serde(deny_unknown_fields)]
168168
pub struct TestSuite {
169169
pub name: String,
@@ -180,13 +180,13 @@ pub struct TestSuite {
180180
pub suites: Vec<TestSuite>,
181181
}
182182

183-
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
183+
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
184184
#[serde(deny_unknown_fields)]
185185
pub struct TestFixture {
186186
pub suites: Vec<TestSuite>,
187187
}
188188

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

198-
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
198+
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
199199
#[serde(deny_unknown_fields)]
200200
pub struct TestDefaults {
201201
pub bundle: BundleDefaults,

fluent-bundle/tests/resolver_fixtures.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use fluent_bundle::resolver::ResolverError;
1010
use fluent_bundle::FluentArgs;
1111
use fluent_bundle::FluentError;
1212
use fluent_bundle::{FluentBundle, FluentResource, FluentValue};
13-
use rand::distributions::Alphanumeric;
14-
use rand::{thread_rng, Rng};
13+
use rand::distr::Alphanumeric;
14+
use rand::{rng, Rng};
1515
use unic_langid::LanguageIdentifier;
1616

1717
use helpers::*;
@@ -72,7 +72,7 @@ impl Scope {
7272
}
7373

7474
fn generate_random_hash() -> String {
75-
let mut rng = thread_rng();
75+
let mut rng = rng();
7676
let chars: String = iter::repeat(())
7777
.map(|()| rng.sample(Alphanumeric))
7878
.map(char::from)

fluent-fallback/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Changelog
22

33
## Unreleased
4-
5-
-
4+
- Refactor to remove unnecessary named lifetimes
5+
- Cleanup docs
6+
- Satiate Clippy
7+
- Bump `once_cell` to 1.21
68

79
## fluent-fallback 0.7.1 (March 16, 2024)
810
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers

fluent-fallback/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rustc-hash.workspace = true
2222
unic-langid.workspace = true
2323
async-trait = "0.1"
2424
chunky-vec = "0.1"
25-
once_cell = "1.19"
25+
once_cell.workspace = true
2626
pin-cell = "0.2"
2727

2828
[dev-dependencies]

fluent-fallback/examples/simple-fallback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_hash::FxHashSet;
3232
use unic_langid::{langid, LanguageIdentifier};
3333

3434
/// This helper struct holds the scheme for converting
35-
/// resource paths into full paths. It is used to customise
35+
/// resource paths into full paths. It is used to customize
3636
/// `fluent-fallback::SyncLocalization`.
3737
struct Bundles {
3838
res_path_scheme: PathBuf,

fluent-fallback/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use fluent_bundle::FluentError;
22
use std::error::Error;
33
use unic_langid::LanguageIdentifier;
44

5-
#[derive(Debug, PartialEq, Eq)]
5+
#[derive(Debug, Eq, PartialEq)]
66
pub enum LocalizationError {
77
Bundle {
88
error: FluentError,

0 commit comments

Comments
 (0)