Apply cargo fmt --all
This commit is contained in:
+4
-24
@@ -37,24 +37,14 @@ pub trait IntoPrefixes<T> {
|
|||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<T> IntoPrefixes<T> for String {
|
impl<T> IntoPrefixes<T> for String {
|
||||||
async fn get(
|
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
|
||||||
&self,
|
|
||||||
_: &Runtime<T>,
|
|
||||||
_: Option<u64>,
|
|
||||||
_: Option<u64>,
|
|
||||||
) -> Vec<String> {
|
|
||||||
vec![self.to_string()]
|
vec![self.to_string()]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<T> IntoPrefixes<T> for &str {
|
impl<T> IntoPrefixes<T> for &str {
|
||||||
async fn get(
|
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
|
||||||
&self,
|
|
||||||
_: &Runtime<T>,
|
|
||||||
_: Option<u64>,
|
|
||||||
_: Option<u64>,
|
|
||||||
) -> Vec<String> {
|
|
||||||
vec![self.to_string()]
|
vec![self.to_string()]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,12 +54,7 @@ impl<T: Send + Sync + 'static, const N: usize, S: Send + Sync + 'static> IntoPre
|
|||||||
where
|
where
|
||||||
T: ToString,
|
T: ToString,
|
||||||
{
|
{
|
||||||
async fn get(
|
async fn get(&self, _: &Runtime<S>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
|
||||||
&self,
|
|
||||||
_: &Runtime<S>,
|
|
||||||
_: Option<u64>,
|
|
||||||
_: Option<u64>,
|
|
||||||
) -> Vec<String> {
|
|
||||||
self.iter().map(|s| s.to_string()).collect()
|
self.iter().map(|s| s.to_string()).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,12 +65,7 @@ where
|
|||||||
F: Fn() -> Fut + Send + Sync + 'static,
|
F: Fn() -> Fut + Send + Sync + 'static,
|
||||||
Fut: Future<Output = Vec<String>> + Send,
|
Fut: Future<Output = Vec<String>> + Send,
|
||||||
{
|
{
|
||||||
async fn get(
|
async fn get(&self, _: &Runtime<T>, _: Option<u64>, _: Option<u64>) -> Vec<String> {
|
||||||
&self,
|
|
||||||
_: &Runtime<T>,
|
|
||||||
_: Option<u64>,
|
|
||||||
_: Option<u64>,
|
|
||||||
) -> Vec<String> {
|
|
||||||
(self)().await
|
(self)().await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,11 @@ pub fn censor_message(
|
|||||||
for finding in findings {
|
for finding in findings {
|
||||||
for (index, _) in normalized.message.match_indices(finding) {
|
for (index, _) in normalized.message.match_indices(finding) {
|
||||||
let start_index = normalized.mappings.get(index).cloned().unwrap_or(0);
|
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));
|
ranges.push((start_index, end_index));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user