fix: clippy warnings in rust 1.83 (#907)

This commit is contained in:
Myriad-Dreamin 2024-11-29 14:50:22 +08:00 committed by GitHub
parent 6d5c353fc0
commit b8f65cf2ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 63 additions and 59 deletions

View file

@ -286,11 +286,13 @@ impl DerefMut for LocalContext {
}
impl LocalContext {
/// Set the files for LSP-based completion.
#[cfg(test)]
pub fn test_completion_files(&mut self, f: impl FnOnce() -> Vec<TypstFileId>) {
self.caches.completion_files.get_or_init(f);
}
/// Set the files for analysis.
#[cfg(test)]
pub fn test_files(&mut self, f: impl FnOnce() -> Vec<TypstFileId>) {
self.caches.root_files.get_or_init(f);
@ -335,7 +337,7 @@ impl LocalContext {
/// Get the module dependencies of the workspace.
pub fn module_dependencies(&mut self) -> &HashMap<TypstFileId, ModuleDependency> {
if self.caches.module_deps.get().is_some() {
return self.caches.module_deps.get().unwrap();
self.caches.module_deps.get().unwrap()
} else {
// may cause multiple times to calculate, but it is okay because we have mutable
// reference to self.