Skip to content

Commit fde63cb

Browse files
committed
Merge branch 'main' into clippy-fixes
2 parents 2150dd4 + 466e100 commit fde63cb

File tree

23 files changed

+219
-135
lines changed

23 files changed

+219
-135
lines changed

Cargo.toml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
[workspace]
22
resolver = "2"
33
members = [
4-
"fluent-syntax",
5-
"fluent-bundle",
6-
"fluent-fallback",
7-
"fluent-resmgr",
8-
"fluent-pseudo",
9-
"fluent-testing",
10-
"fluent",
11-
"intl-memoizer"
4+
"fluent-syntax",
5+
"fluent-bundle",
6+
"fluent-fallback",
7+
"fluent-resmgr",
8+
"fluent-pseudo",
9+
"fluent-testing",
10+
"fluent",
11+
"intl-memoizer",
1212
]
1313

14-
exclude = [
15-
"fluent-cli",
16-
]
14+
exclude = ["fluent-cli"]
1715

1816
[workspace.dependencies]
19-
criterion = "0.3"
17+
criterion = "0.5"
2018
fluent-langneg = "0.13"
2119
futures = "0.3"
2220
iai = "0.1"
@@ -28,7 +26,7 @@ thiserror = "1.0"
2826
tokio = "1.0"
2927
unic-langid = "0.9"
3028

31-
fluent-bundle = { path = "fluent-bundle" }
32-
fluent-fallback = { path = "fluent-fallback" }
33-
fluent-pseudo = { path = "fluent-pseudo" }
34-
fluent-syntax = { path = "fluent-syntax" }
29+
fluent-bundle = { version = "0.15.3", path = "fluent-bundle" }
30+
fluent-fallback = { version = "0.7.1", path = "fluent-fallback" }
31+
fluent-pseudo = { version = "0.3.2", path = "fluent-pseudo" }
32+
fluent-syntax = { version = "0.11.1", path = "fluent-syntax" }

fluent-bundle/CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
# Changelog
22

33
## Unreleased
4-
5-
-
6-
4+
- Bump `self_cell` to 1.x
5+
- Bump `serde_yaml` to 0.9
6+
7+
## fluent-bundle 0.15.3 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Implement `From<&String>` for `FluentValue`
10+
- Add `FluentValue.into_string` to prevent String clone
11+
- Fix `FluentValue::try_number` accepting numbers
12+
- Allow optional arguments on `FluentValue`
13+
- Fix behavior of `FluentArgs::set`
14+
- Resolve function instead in `impl ResolveValue`
15+
- Add type alias for concurrent `FluentBundle`
16+
- Fix `FluentBundle::format_pattern` lifetimes
17+
- Workspace: Update to Rust 2021
18+
- Workspace: Add various missing documentation and fix typos and links
19+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
20+
- Workspace: Apply rustfmt and clippy lint fixes
721
## fluent-bundle 0.15.2 (October 25, 2021)
822
- Bump `self_cell` to 0.10.
923

fluent-bundle/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ description = """
44
A localization system designed to unleash the entire expressive power of
55
natural language translations.
66
"""
7-
version = "0.15.2"
7+
version = "0.15.3"
88
edition = "2021"
99
authors = [
10-
"Zibi Braniecki <[email protected]>",
11-
"Staś Małolepszy <[email protected]>"
10+
"Zibi Braniecki <[email protected]>",
11+
"Staś Małolepszy <[email protected]>",
1212
]
1313
homepage = "http://www.projectfluent.org"
1414
license = "Apache-2.0 OR MIT"
@@ -17,12 +17,12 @@ readme = "README.md"
1717
keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
1818
categories = ["localization", "internationalization"]
1919
include = [
20-
"src/**/*",
21-
"benches/*.rs",
22-
"Cargo.toml",
23-
"README.md",
24-
"LICENSE-APACHE",
25-
"LICENSE-MIT"
20+
"src/**/*",
21+
"benches/*.rs",
22+
"Cargo.toml",
23+
"README.md",
24+
"LICENSE-APACHE",
25+
"LICENSE-MIT",
2626
]
2727

2828
[dependencies]
@@ -31,17 +31,17 @@ fluent-syntax.workspace = true
3131
intl_pluralrules.workspace = true
3232
rustc-hash.workspace = true
3333
unic-langid.workspace = true
34-
intl-memoizer = { path = "../intl-memoizer" }
35-
self_cell = "0.10"
34+
intl-memoizer = { version = "0.5.2", path = "../intl-memoizer" }
35+
self_cell = "1.0"
3636
smallvec = "1"
3737

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

4646
[features]
4747
default = []

fluent-fallback/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
-
66

7+
## fluent-fallback 0.7.1 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Migrate to `pin_cell` crate
10+
- Workspace: Update to Rust 2021
11+
- Workspace: Add various missing documentation and fix typos and links
12+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
13+
- Workspace: Apply rustfmt and clippy lint fixes
14+
715
## fluent-fallback 0.7.0 (Nov 9, 2022)
816
- The `ResourceId`s are now stored as a `HashSet` rather than as a Vec. Adding a
917
duplicate `ResourceId` is now a noop.

fluent-fallback/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = """
44
High-level abstraction model for managing localization resources
55
and runtime localization lifecycle.
66
"""
7-
version = "0.7.0"
7+
version = "0.7.1"
88
edition = "2021"
99
authors = [
1010
"Zibi Braniecki <[email protected]>",

fluent-fallback/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
//! Resource identifiers can refer to resources that are either required or optional.
6363
//! In the above example, `"test.ftl"` is a required resource (the default using `.into()`),
6464
//! and `"test2.ftl"` is an optional resource, which you can create via the
65-
//! [`ToResourceId`](fluent_fallback::types::ToResourceId) trait.
65+
//! [`ToResourceId`](types::ToResourceId) trait.
6666
//!
6767
//! A required resource must be present in order for the a bundle to be considered valid.
6868
//! If a required resource is missing for a given locale, a bundle will not be generated for that locale.

fluent-pseudo/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
-
66

7+
## fluent-pseudo 0.3.2 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Allow optional resources, adds `ResourceId` struct
10+
- Workspace: Update to Rust 2021
11+
- Workspace: Add various missing documentation and fix typos and links
12+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
13+
- Workspace: Apply rustfmt and clippy lint fixes
14+
715
## fluent-pseudo 0.3.1 (July 21, 2021)
816
- Update README to document the API changes in 0.3.0.
917

fluent-pseudo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "fluent-pseudo"
33
description = """
44
Pseudolocalization transformation API for use with Project Fluent API.
55
"""
6-
version = "0.3.1"
6+
version = "0.3.2"
77
edition = "2021"
88
authors = [
99
"Zibi Braniecki <[email protected]>",

fluent-resmgr/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
-
66

7+
## fluent-resmgr 0.0.7 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Return a result for `ResourceManager::get_resource`
10+
- Workspace: Update to Rust 2021
11+
- Workspace: Add various missing documentation and fix typos and links
12+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
13+
- Workspace: Apply rustfmt and clippy lint fixes
14+
715
## fluent-resmgr 0.0.6 (Nov 9, 2022)
816
- Update `fluent-fallback` to 0.7.0.
917

fluent-resmgr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "fluent-resmgr"
33
description = """
44
Resource manager for Fluent localization resources.
55
"""
6-
version = "0.0.6"
6+
version = "0.0.7"
77
authors = [
88
"Zibi Braniecki <[email protected]>",
99
"Staś Małolepszy <[email protected]>"

fluent-syntax/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
- Add module `serializer`.
55
-
66

7+
## fluent-syntax 0.11.1 (March 16, 2024)
8+
- This is a 'safe harbor' release prior to bringing on non-Mozilla community maintainers
9+
- Create generic ftl serializer `fluent_syntax::serializer`
10+
- Fix crash when parsing multiline CRLF comment
11+
- Treat tab as text, not whitespace, adds `parser::matches_fluent_ws` function
12+
- Workspace: Update to Rust 2021
13+
- Workspace: Add various missing documentation and fix typos and links
14+
- Workspace: Cleanup meta-data using workspaces, use SPDX licenses, etc.
15+
- Workspace: Apply rustfmt and clippy lint fixes
16+
717
## fluent-syntax 0.11.0 (February 9, 2021)
818
- Document the crate.
919
- Switch to use `thiserror` for Error annotations.

fluent-syntax/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "fluent-syntax"
33
description = """
44
Parser/Serializer tools for Fluent Syntax.
55
"""
6-
version = "0.11.0"
6+
version = "0.11.1"
77
edition = "2021"
88
authors = [
99
"Zibi Braniecki <[email protected]>",
@@ -25,6 +25,7 @@ include = [
2525
]
2626

2727
[dependencies]
28+
memchr = "2.0"
2829
serde = { workspace = true, optional = true, features = ["derive"] }
2930
serde_json = { workspace = true, optional = true }
3031
thiserror.workspace = true

fluent-syntax/src/parser/macros.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ macro_rules! get_current_byte {
99
$s.source.as_ref().as_bytes().get($s.ptr)
1010
};
1111
}
12+
13+
macro_rules! get_remaining_bytes {
14+
($s:expr) => {
15+
$s.source.as_ref().as_bytes().get($s.ptr..)
16+
};
17+
}

fluent-syntax/src/parser/pattern.rs

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -157,51 +157,64 @@ where
157157
&mut self,
158158
) -> Result<(usize, usize, TextElementType, TextElementTermination)> {
159159
let start_pos = self.ptr;
160-
let mut text_element_type = TextElementType::Blank;
161-
162-
while let Some(b) = get_current_byte!(self) {
163-
match b {
164-
b' ' => self.ptr += 1,
165-
b'\n' => {
166-
self.ptr += 1;
167-
return Ok((
168-
start_pos,
169-
self.ptr,
170-
text_element_type,
171-
TextElementTermination::LineFeed,
172-
));
173-
}
174-
b'\r' if self.is_byte_at(b'\n', self.ptr + 1) => {
175-
self.ptr += 1;
176-
return Ok((
177-
start_pos,
178-
self.ptr - 1,
179-
text_element_type,
180-
TextElementTermination::Crlf,
181-
));
182-
}
183-
b'{' => {
184-
return Ok((
185-
start_pos,
186-
self.ptr,
187-
text_element_type,
188-
TextElementTermination::PlaceableStart,
189-
));
190-
}
191-
b'}' => {
192-
return error!(ErrorKind::UnbalancedClosingBrace, self.ptr);
193-
}
194-
_ => {
195-
text_element_type = TextElementType::NonBlank;
196-
self.ptr += 1;
197-
}
160+
let Some(rest) = get_remaining_bytes!(self) else {
161+
return Ok((
162+
start_pos,
163+
self.ptr,
164+
TextElementType::Blank,
165+
TextElementTermination::Eof,
166+
));
167+
};
168+
let end = memchr::memchr3(b'\n', b'{', b'}', rest);
169+
let element_type = |text: &[u8]| {
170+
if text.iter().any(|&c| c != b' ') {
171+
TextElementType::NonBlank
172+
} else {
173+
TextElementType::Blank
174+
}
175+
};
176+
match end.map(|p| &rest[..=p]) {
177+
Some([text @ .., b'}']) => {
178+
self.ptr += text.len();
179+
error!(ErrorKind::UnbalancedClosingBrace, self.ptr)
180+
}
181+
Some([text @ .., b'\r', b'\n']) => {
182+
self.ptr += text.len() + 1;
183+
Ok((
184+
start_pos,
185+
self.ptr - 1,
186+
element_type(text),
187+
TextElementTermination::Crlf,
188+
))
189+
}
190+
Some([text @ .., b'\n']) => {
191+
self.ptr += text.len() + 1;
192+
Ok((
193+
start_pos,
194+
self.ptr,
195+
element_type(text),
196+
TextElementTermination::LineFeed,
197+
))
198+
}
199+
Some([text @ .., b'{']) => {
200+
self.ptr += text.len();
201+
Ok((
202+
start_pos,
203+
self.ptr,
204+
element_type(text),
205+
TextElementTermination::PlaceableStart,
206+
))
207+
}
208+
None => {
209+
self.ptr += rest.len();
210+
Ok((
211+
start_pos,
212+
self.ptr,
213+
element_type(rest),
214+
TextElementTermination::Eof,
215+
))
198216
}
217+
_ => unreachable!(),
199218
}
200-
Ok((
201-
start_pos,
202-
self.ptr,
203-
text_element_type,
204-
TextElementTermination::Eof,
205-
))
206219
}
207220
}

0 commit comments

Comments
 (0)