Convert 'prepare_tab_completion' to ternary operation in 'chat' file

This commit is contained in:
Dr. Dystopia 2021-07-08 16:38:27 +02:00
parent 72fa4f2180
commit 7ded50a668

View File

@ -106,11 +106,11 @@ impl<'a> Chat<'a> {
}
pub fn prepare_tab_completion(mut self, input: String) -> Self {
if let Some(index) = input.find('\t') {
self.force_completions = Some(cmd::complete(&input[..index], &self.client));
self.force_completions = if let Some(index) = input.find('\t') {
Some(cmd::complete(&input[..index], &self.client))
} else {
self.force_completions = None;
}
None
};
self
}