formatting

fix formatting

fixed last formatting issue

Signed-off-by: faldor20 <eli.jambu@yahoo.com>
This commit is contained in:
Eli Dowling 2024-01-25 11:13:19 +10:00 committed by faldor20
parent 987e0c6c4b
commit 84e8e61fa5
No known key found for this signature in database
GPG key ID: F2216079B890CD57
2 changed files with 9 additions and 18 deletions

View file

@ -41,11 +41,7 @@ pub(crate) struct Registry {
impl Registry { impl Registry {
pub async fn get_latest_version(&self, url: &Url) -> Option<i32> { pub async fn get_latest_version(&self, url: &Url) -> Option<i32> {
self.documents self.documents.lock().await.get(url).map(|x| x.info.version)
.lock()
.await
.get(url)
.map(|x| x.info.version)
} }
fn update_document( fn update_document(
@ -54,8 +50,9 @@ impl Registry {
updating_url: &Url, updating_url: &Url,
) { ) {
if &document.doc_info.url == updating_url { if &document.doc_info.url == updating_url {
if let Some(a) = documents if let Some(a) = documents.get_mut(updating_url) {
.get_mut(updating_url) { a.latest_document.set(document.clone()).unwrap() } a.latest_document.set(document.clone()).unwrap()
}
} }
let url = document.url().clone(); let url = document.url().clone();
@ -146,9 +143,8 @@ impl Registry {
} }
pub async fn diagnostics(&self, url: &Url) -> Vec<Diagnostic> { pub async fn diagnostics(&self, url: &Url) -> Vec<Diagnostic> {
let Some( document) = self.latest_document_by_url(url).await else { let Some(document) = self.latest_document_by_url(url).await else {
return vec![]; return vec![];
}; };
document.diagnostics() document.diagnostics()
} }

View file

@ -118,9 +118,7 @@ impl RocServerState {
&self.registry &self.registry
} }
async fn close(&self, _fi: Url) { async fn close(&self, _fi: Url) {}
}
pub async fn change( pub async fn change(
&self, &self,
@ -348,15 +346,12 @@ async fn main() {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::{ use std::sync::Once;
sync::{Once},
};
use indoc::indoc;
use expect_test::expect; use expect_test::expect;
use indoc::indoc;
use log::info; use log::info;
use super::*; use super::*;
fn completion_resp_to_labels(resp: CompletionResponse) -> Vec<String> { fn completion_resp_to_labels(resp: CompletionResponse) -> Vec<String> {