Skip to content

Expose UNICODE_VERSION const#42

Merged
dtolnay merged 1 commit intodtolnay:masterfrom
Marcondiro:master
Oct 30, 2025
Merged

Expose UNICODE_VERSION const#42
dtolnay merged 1 commit intodtolnay:masterfrom
Marcondiro:master

Conversation

@Marcondiro
Copy link
Contributor

Hello, this PR adds the exposed UNICODE_VERSION const.
This brings complete feature parity with unicode-xid.
Thanks!

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

let (name, extension) = filename
.rsplit_once('.')
.expect("Failed to split file name into name and extension");
let re = Regex::new(&format!(r"# {name}-(\d+).(\d+).(\d+).{extension}")).unwrap();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let re = Regex::new(&format!(r"# {name}-(\d+).(\d+).(\d+).{extension}")).unwrap();
let re = Regex::new(&format!(r"# {name}-(\d+)\.(\d+)\.(\d+)\.{extension}")).unwrap();

Comment on lines +92 to +102
let v = caps
.iter()
.skip(1)
.map(|s| {
s.unwrap()
.as_str()
.parse()
.expect("Failed to parse unicode version")
})
.collect::<Vec<u64>>();
(v[0], v[1], v[2])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some APIs that make this neater:

Suggested change
let v = caps
.iter()
.skip(1)
.map(|s| {
s.unwrap()
.as_str()
.parse()
.expect("Failed to parse unicode version")
})
.collect::<Vec<u64>>();
(v[0], v[1], v[2])
let (_, [major, minor, patch]) = caps.extract();
[major, minor, patch]
.map(|s| s.parse().expect("Failed to parse unicode version"))
.into()

@dtolnay dtolnay merged commit 2e6902a into dtolnay:master Oct 30, 2025
10 checks passed
@Marcondiro
Copy link
Contributor Author

Thanks for merging and for the suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants