Apply cargo fmt --all

This commit is contained in:
2025-08-12 22:45:59 -03:00
parent 39c455f617
commit 5806493ca8
6 changed files with 64 additions and 80 deletions
+4 -24
View File
@@ -37,24 +37,14 @@ pub trait IntoPrefixes<T> {
#[async_trait]
impl<T> IntoPrefixes<T> for String {
async fn get(
&self,
_: &Runtime<T>,
_: Option<u64>,
_: Option<u64>,
) -> Vec<String> {
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
vec![self.to_string()]
}
}
#[async_trait]
impl<T> IntoPrefixes<T> for &str {
async fn get(
&self,
_: &Runtime<T>,
_: Option<u64>,
_: Option<u64>,
) -> Vec<String> {
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
vec![self.to_string()]
}
}
@@ -64,12 +54,7 @@ impl<T: Send + Sync + 'static, const N: usize, S: Send + Sync + 'static> IntoPre
where
T: ToString,
{
async fn get(
&self,
_: &Runtime<S>,
_: Option<u64>,
_: Option<u64>,
) -> Vec<String> {
async fn get(&self, _: &Runtime<S>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
self.iter().map(|s| s.to_string()).collect()
}
}
@@ -80,12 +65,7 @@ where
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = Vec<String>> + Send,
{
async fn get(
&self,
_: &Runtime<T>,
_: Option<u64>,
_: Option<u64>,
) -> Vec<String> {
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
(self)().await
}
}
+5 -1
View File
@@ -184,7 +184,11 @@ pub fn censor_message(
for finding in findings {
for (index, _) in normalized.message.match_indices(finding) {
let start_index = normalized.mappings.get(index).cloned().unwrap_or(0);
let end_index = normalized.mappings.get(index + finding.len()).cloned().unwrap_or(original.len());
let end_index = normalized
.mappings
.get(index + finding.len())
.cloned()
.unwrap_or(original.len());
ranges.push((start_index, end_index));
}