Skip to content

Commit 584009b

Browse files
authored
Merge pull request #145 from greyblake/rust-2024
Rust 2024
2 parents 185d55f + 2bc5bf0 commit 584009b

21 files changed

Lines changed: 44 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
### v0.18.0 - 2025-10-16
2+
* [BREAKING] Update to Rust edition 2024
3+
14
### v0.17.0 - 2025-10-16
2-
* Support Welsh
5+
* [BREAKING] Support Welsh
36
* Bump hashbrown to 15
47

58
### v0.16.4 - 2024-01-04

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "whatlang"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
authors = ["Serhii Potapov <blake131313@gmail.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
description = "Fast and lightweight language identification library for Rust."
77
keywords = ["language", "nlp", "lang", "whatlang", "text"]
88
license = "MIT"

benches/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate bencher;
44
use bencher::Bencher;
55
use std::collections::HashMap;
66
use whatlang::dev::{
7-
alphabet_cyrillic_calculate_scores, alphabet_latin_calculate_scores, FilterList, LowercaseText,
7+
FilterList, LowercaseText, alphabet_cyrillic_calculate_scores, alphabet_latin_calculate_scores,
88
};
99
use whatlang::{detect, detect_script};
1010

src/alphabets/cyrillic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use super::common::{build_inverted_map, generic_alphabet_calculate_scores};
21
use super::RawOutcome;
2+
use super::common::{build_inverted_map, generic_alphabet_calculate_scores};
33
use crate::core::{FilterList, LowercaseText};
44
use crate::{Lang, Script};
55
use std::sync::LazyLock;

src/alphabets/detection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::RawOutcome;
22
use super::{cyrillic, latin};
3-
use crate::core::{calculate_confidence, FilterList, Info, InternalQuery, LowercaseText};
43
use crate::Lang;
4+
use crate::core::{FilterList, Info, InternalQuery, LowercaseText, calculate_confidence};
55

66
pub fn detect(iquery: &InternalQuery) -> Option<Info> {
77
let raw_outcome = raw_detect(iquery);

src/alphabets/latin.rs

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

3-
use super::common::{build_inverted_map, generic_alphabet_calculate_scores};
43
use super::RawOutcome;
4+
use super::common::{build_inverted_map, generic_alphabet_calculate_scores};
55
use crate::core::{FilterList, LowercaseText};
66
use crate::{Lang, Script};
77

@@ -95,8 +95,8 @@ pub fn alphabet_calculate_scores(text: &LowercaseText, filter_list: &FilterList)
9595
#[cfg(test)]
9696
mod tests {
9797
use super::*;
98-
use crate::utils::is_stop_char;
9998
use crate::Script;
99+
use crate::utils::is_stop_char;
100100

101101
// Old naive implementation, that is not very effective but easy to understand
102102
fn naive_alphabet_calculate_scores(

src/combined/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
use crate::Lang;
12
use crate::alphabets;
2-
use crate::core::{calculate_confidence, Info, InternalQuery};
3+
use crate::core::{Info, InternalQuery, calculate_confidence};
34
use crate::trigrams;
4-
use crate::Lang;
55

66
#[derive(Debug)]
77
pub struct RawOutcome {

src/core/detect.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use crate::Lang;
12
use crate::core::{Info, Method, Options, Query};
23
use crate::scripts::{
4+
RawScriptInfo, Script,
35
grouping::{MultiLangScript, ScriptLangGroup},
4-
raw_detect_script, RawScriptInfo, Script,
6+
raw_detect_script,
57
};
6-
use crate::Lang;
78
use crate::{alphabets, combined, trigrams};
89

910
/// Detect only a language by a given text.

src/core/detector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use crate::Lang;
12
use crate::core;
23
use crate::core::FilterList;
34
use crate::core::Info;
45
use crate::core::Options;
5-
use crate::scripts::{detect_script, Script};
6-
use crate::Lang;
6+
use crate::scripts::{Script, detect_script};
77

88
/// Configurable structure that holds detection options and provides functions
99
/// to detect language and script.

src/core/filter_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ impl FilterList {
2626
pub fn is_allowed(&self, lang: Lang) -> bool {
2727
match self {
2828
Self::All => true,
29-
Self::Allow(ref allowlist) => allowlist.contains(&lang),
30-
Self::Deny(ref denylist) => !denylist.contains(&lang),
29+
Self::Allow(allowlist) => allowlist.contains(&lang),
30+
Self::Deny(denylist) => !denylist.contains(&lang),
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)