Skip to content

Commit bae8291

Browse files
berkusKeats
andauthored
refactor: πŸ“¦ Replace unmaintained unic-segment dependency (#979)
* refactor: πŸ“¦ Replace unmaintained unic-segment dependency * chore(ci): ♻️ Remove cargo deny obsolete settings Allow Unicode-3.0 OSI-approved license for unicode-segmentation. * chore(build): πŸ‘·β€β™‚οΈ Bump MSRV * chore(ci): ♻️ Update github actions * Update Windows build OS version to 2022 --------- Co-authored-by: Vincent Prouillet <balthek@gmail.com>
1 parent af0b32f commit bae8291

File tree

8 files changed

+18
-47
lines changed

8 files changed

+18
-47
lines changed

β€Ž.github/workflows/cargo-deny-cron.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- bans licenses sources
1818

1919
steps:
20-
- uses: actions/checkout@v3
21-
- uses: EmbarkStudios/cargo-deny-action@v1
20+
- uses: actions/checkout@v5
21+
- uses: EmbarkStudios/cargo-deny-action@v2
2222
with:
2323
command: check ${{ matrix.checks }}

β€Ž.github/workflows/cargo-deny-pr.ymlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
continue-on-error: ${{ matrix.checks == 'advisories' }}
1818

1919
steps:
20-
- uses: actions/checkout@v3
21-
- uses: EmbarkStudios/cargo-deny-action@v1
20+
- uses: actions/checkout@v5
21+
- uses: EmbarkStudios/cargo-deny-action@v2
2222
with:
2323
command: check ${{ matrix.checks }}

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
include:
1616
- build: msrv
1717
os: ubuntu-latest
18-
rust: 1.70.0
18+
rust: 1.85.0
1919
- build: stable
2020
os: ubuntu-latest
2121
rust: stable
@@ -26,10 +26,10 @@ jobs:
2626
os: macOS-latest
2727
rust: stable
2828
- build: win-msvc
29-
os: windows-2019
29+
os: windows-2022
3030
rust: stable
3131
steps:
32-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v5
3333
- name: Install Rust
3434
uses: dtolnay/rust-toolchain@master
3535
with:
@@ -47,7 +47,7 @@ jobs:
4747
name: wasm
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v3
50+
- uses: actions/checkout@v5
5151

5252
- name: Install
5353
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

β€Ž.github/workflows/docs.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: checkout
12-
uses: actions/checkout@v3.0.0
12+
uses: actions/checkout@v5
1313
- name: build_and_deploy
1414
uses: shalzz/zola-deploy-action@v0.17.2
1515
env:

β€ŽCargo.tomlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ keywords = ["template", "html", "django", "markup", "jinja2"]
1111
categories = ["template-engine"]
1212
edition = "2018"
1313
include = ["/src/**/*", "/LICENSE", "/README.md", "/CHANGELOG.md"]
14-
rust-version = "1.70"
14+
rust-version = "1.85"
1515

1616
[dependencies]
1717
globwalk = "0.9.1"
@@ -23,7 +23,7 @@ lazy_static = "1.4"
2323
# used in striptags, spaceless & titles filters. Already pulled by globwalk
2424
regex = "1.7"
2525
# used in truncate filter and string iteration
26-
unic-segment = "0.9"
26+
unicode-segmentation = "1.12"
2727

2828
# used in slugify filter
2929
slug = {version = "0.1", optional = true}

β€Ždeny.tomlβ€Ž

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
# this list would mean the nix crate, as well as any of its exclusive
1818
# dependencies not shared by any other crates, would be ignored, as the target
1919
# list here is effectively saying which targets you are building for.
20-
targets = [
20+
# targets = [
2121
# The triple can be any string, but only the target triples built in to
2222
# rustc (as of 1.40) can be checked against actual config expressions
2323
#{ triple = "x86_64-unknown-linux-musl" },
2424
# You can also specify which target_features you promise are enabled for a
2525
# particular target. target_features are currently not validated against
2626
# the actual valid features supported by the target architecture.
2727
#{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
28-
]
28+
# ]
2929

3030
# This section is considered when running `cargo deny check advisories`
3131
# More documentation for the advisories section can be found here:
@@ -35,16 +35,8 @@ targets = [
3535
db-path = "~/.cargo/advisory-db"
3636
# The url(s) of the advisory databases to use
3737
db-urls = ["https://github.com/rustsec/advisory-db"]
38-
# The lint level for security vulnerabilities
39-
vulnerability = "deny"
40-
# The lint level for unmaintained crates
41-
unmaintained = "warn"
4238
# The lint level for crates that have been yanked from their source registry
4339
yanked = "warn"
44-
# The lint level for crates with security notices. Note that as of
45-
# 2019-12-17 there are no security notice advisories in
46-
# https://github.com/rustsec/advisory-db
47-
notice = "warn"
4840
# A list of advisory IDs to ignore. Note that ignored advisories will still
4941
# output a note when they are encountered.
5042
ignore = [
@@ -70,36 +62,15 @@ ignore = [
7062
# More documentation for the licenses section can be found here:
7163
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
7264
[licenses]
73-
# The lint level for crates which do not have a detectable license
74-
unlicensed = "deny"
7565
# List of explicitly allowed licenses
7666
# See https://spdx.org/licenses/ for list of possible licenses
7767
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
7868
allow = [
7969
"MIT",
8070
"Apache-2.0",
8171
"BSD-3-Clause",
72+
"Unicode-3.0",
8273
]
83-
# List of explicitly disallowed licenses
84-
# See https://spdx.org/licenses/ for list of possible licenses
85-
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
86-
deny = [
87-
#"Nokia",
88-
]
89-
# Lint level for licenses considered copyleft
90-
copyleft = "warn"
91-
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
92-
# * both - The license will be approved if it is both OSI-approved *AND* FSF
93-
# * either - The license will be approved if it is either OSI-approved *OR* FSF
94-
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
95-
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
96-
# * neither - This predicate is ignored and the default lint level is used
97-
allow-osi-fsf-free = "neither"
98-
# Lint level used when no other predicates are matched
99-
# 1. License isn't in the allow or deny lists
100-
# 2. License isn't copyleft
101-
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
102-
default = "deny"
10374
# The confidence threshold for detecting a license from license text.
10475
# The higher the value, the more closely the license text must be to the
10576
# canonical license text of a valid SPDX license file.

β€Žsrc/builtins/filters/string.rsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::collections::HashMap;
44
use lazy_static::lazy_static;
55
use regex::{Captures, Regex};
66
use serde_json::value::{to_value, Value};
7-
use unic_segment::GraphemeIndices;
7+
use unicode_segmentation::UnicodeSegmentation;
88

99
#[cfg(feature = "urlencode")]
1010
use percent_encoding::{percent_encode, AsciiSet, NON_ALPHANUMERIC};
@@ -165,7 +165,7 @@ pub fn truncate(value: &Value, args: &HashMap<String, Value>) -> Result<Value> {
165165
None => "…".to_string(),
166166
};
167167

168-
let graphemes = GraphemeIndices::new(&s).collect::<Vec<(usize, &str)>>();
168+
let graphemes = s.grapheme_indices(true).collect::<Vec<(usize, &str)>>();
169169

170170
// Nothing to truncate?
171171
if length >= graphemes.len() {

β€Žsrc/renderer/for_loop.rsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22

33
use serde_json::Value;
4-
use unic_segment::Graphemes;
4+
use unicode_segmentation::UnicodeSegmentation;
55

66
use crate::renderer::stack_frame::Val;
77

@@ -58,7 +58,7 @@ impl<'a> ForLoopValues<'a> {
5858
}
5959
},
6060
ForLoopValues::String(ref values) => {
61-
let mut graphemes = Graphemes::new(values.as_str().expect("Is string"));
61+
let mut graphemes = values.as_str().expect("Is string").graphemes(true);
6262
Cow::Owned(Value::String(graphemes.nth(i).expect("Value").to_string()))
6363
}
6464
ForLoopValues::Object(ref values) => values.get(i).expect("Value").1.clone(),

0 commit comments

Comments
Β (0)