mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
fix(api): Clarify lifetimes
This commit is contained in:
parent
0cdd64c038
commit
e59d7817b4
1 changed files with 2 additions and 2 deletions
|
@ -46,11 +46,11 @@ impl Corrections {
|
|||
Corrections { }
|
||||
}
|
||||
|
||||
pub fn correct_str(&self, word: &str) -> Option<&str> {
|
||||
pub fn correct_str<'s>(&'s self, word: &str) -> Option<&'s str> {
|
||||
DICTIONARY.get(word).map(|s| *s)
|
||||
}
|
||||
|
||||
pub fn correct_bytes(&self, word: &[u8]) -> Option<&[u8]> {
|
||||
pub fn correct_bytes<'s>(&'s self, word: &[u8]) -> Option<&'s [u8]> {
|
||||
std::str::from_utf8(word).ok().and_then(|word| DICTIONARY.get(word)).map(|s| s.as_bytes())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue