diff --git a/src/autoload.rs b/src/autoload.rs index ce1981261..78e51429b 100644 --- a/src/autoload.rs +++ b/src/autoload.rs @@ -212,7 +212,7 @@ pub fn clear(&mut self) { /// This is exposed for testing. #[cfg(test)] fn invalidate_cache(&mut self) { - self.cache = Box::new(AutoloadFileCache::with_dirs(self.cache.dirs().to_owned())); + *self.cache = AutoloadFileCache::with_dirs(self.cache.dirs().to_owned()); } /// Like resolve_autoload(), but accepts the paths directly. @@ -227,7 +227,7 @@ fn resolve_command_impl(&mut self, cmd: &wstr, paths: &[WString]) -> AutoloadRes // Note we don't have to modify autoloadable_files_. We'll naturally detect if those have // changed when we query the cache. if paths != self.cache.dirs() { - self.cache = Box::new(AutoloadFileCache::with_dirs(paths.to_owned())); + *self.cache = AutoloadFileCache::with_dirs(paths.to_owned()); } // Do we have an entry to load? diff --git a/src/builtins/block.rs b/src/builtins/block.rs index 2b7713031..4fcb2fcbd 100644 --- a/src/builtins/block.rs +++ b/src/builtins/block.rs @@ -3,19 +3,14 @@ // Implementation of the block builtin. use super::prelude::*; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] enum Scope { + #[default] Unset, Global, Local, } -impl Default for Scope { - fn default() -> Self { - Self::Unset - } -} - #[derive(Debug, Clone, Copy, Default)] struct Options { scope: Scope, diff --git a/src/highlight/highlight.rs b/src/highlight/highlight.rs index f1cb3090a..3efb19994 100644 --- a/src/highlight/highlight.rs +++ b/src/highlight/highlight.rs @@ -1212,17 +1212,13 @@ fn get_fallback(role: HighlightRole) -> HighlightRole { } } -impl Default for HighlightRole { - fn default() -> Self { - Self::normal - } -} - /// Describes the role of a span of text. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[repr(u8)] +#[derive(Default)] pub enum HighlightRole { - normal, // normal text + #[default] + normal, // normal text error, // error command, // command keyword,