refactor: use one global static collator

This commit is contained in:
Matouš Volf
2024-09-19 22:12:00 +02:00
parent 5cb0241e07
commit 58dc804771
2 changed files with 7 additions and 2 deletions

View File

@ -2,9 +2,9 @@ use std::cmp::Ordering;
use chrono::NaiveDateTime;
use crate::schema::projects;
use diesel::prelude::*;
use feruca::Collator;
use serde::{Deserialize, Serialize};
use validator::Validate;
use crate::internationalization::COLLATOR;
const TITLE_LENGTH_MIN: u64 = 1;
const TITLE_LENGTH_MAX: u64 = 255;
@ -47,7 +47,7 @@ impl PartialOrd<Self> for Project {
impl Ord for Project {
fn cmp(&self, other: &Self) -> Ordering {
Collator::default().collate(self.title(), other.title())
COLLATOR.lock().unwrap().collate(self.title(), other.title())
}
}