Skip to content
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

Update mapping::lookup so it is a const function #49

Merged
merged 3 commits into from
May 17, 2021
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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,38 @@ jobs:
- name: Test with no default features
run: cargo test --no-default-features

build-msrv:
name: Build (1.52.0)
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.52.0"
profile: minimal

- name: Compile
run: cargo build --verbose

- name: Compile tests
run: cargo test --no-run

- name: Test
run: cargo test

- name: Test with all features
run: cargo test --all-features

- name: Test with no default features
run: cargo test --no-default-features

rust:
name: Lint and format Rust
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ All features are enabled by default.
- **std** - Enable linking to the [Rust Standard Library]. Enabling this feature
adds [`Error`] implementations to error types in this crate.

### Minimum Supported Rust Version

This crate requires at least Rust 1.52.0. This version can be bumped in minor
releases.

## License

`focaccia` is licensed under the [MIT License](LICENSE) (c) Ryan Lopopolo.
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_case_lookups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#[must_use]
#[allow(clippy::match_same_arms)]
#[allow(clippy::too_many_lines)]
pub fn lookup(c: char, mode: Mode) -> Mapping {
pub const fn lookup(c: char, mode: Mode) -> Mapping {
let codepoint = c as u32;
let char_bytes = codepoint.to_be_bytes();
let mid_byte = char_bytes[2];
Expand Down
4 changes: 2 additions & 2 deletions src/folding/mapping/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-12-30 17:16:47 UTC.
// Last generated on 2021-05-17 14:03:38 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
Expand All @@ -15,7 +15,7 @@ use super::{Mapping, Mode};
#[must_use]
#[allow(clippy::match_same_arms)]
#[allow(clippy::too_many_lines)]
pub fn lookup(c: char, mode: Mode) -> Mapping {
pub const fn lookup(c: char, mode: Mode) -> Mapping {
let codepoint = c as u32;
let char_bytes = codepoint.to_be_bytes();
let mid_byte = char_bytes[2];
Expand Down
2 changes: 1 addition & 1 deletion tests/full_fold_exhaustive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-12-30 17:16:47 UTC.
// Last generated on 2021-05-17 14:03:38 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
Expand Down
2 changes: 1 addition & 1 deletion tests/full_turkic_fold_exhaustive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This source is autogenerated. Do not modify it directly.
// To make modfications to this code, see `scripts/gen_case_lookups.rb`.
//
// Last generated on 2020-12-30 17:16:47 UTC.
// Last generated on 2021-05-17 14:03:38 UTC.
//
// Unicode version:
// CaseFolding-13.0.0.txt
Expand Down