Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed May 25, 2019
1 parent d93db89 commit 0820d5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use jsonrpc_derive::{jsonrpc_method, jsonrpc_server};
use log::*;
use lsp_types::*;
use serde::de::DeserializeOwned;
use serde_json::error::ErrorCode::Message;
use std::borrow::Cow;
use std::sync::Arc;
use walkdir::WalkDir;
Expand All @@ -44,7 +43,7 @@ impl<C: LspClient + Send + Sync> LatexLspServer<C> {
pub fn new(client: Arc<C>) -> Self {
LatexLspServer {
client,
workspace_manager: WorkspaceManager::new(),
workspace_manager: WorkspaceManager::default(),
event_manager: EventManager::default(),
resolver: Mutex::new(TexResolver::new()),
}
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/latex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl LatexSyntaxTree {
let root = Arc::new(parser.root());
let commands = LatexCommandAnalyzer::find(Arc::clone(&root));
let includes = LatexInclude::parse_all(uri, &commands);
let components = includes.iter().flat_map(|include| include.name()).collect();
let components = includes.iter().flat_map(LatexInclude::name).collect();
let environments = LatexEnvironment::parse_all(&commands);
let is_standalone = environments
.iter()
Expand Down
14 changes: 5 additions & 9 deletions src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ impl Workspace {
continue;
}

let path = PathBuf::from(include.target().to_file_path().unwrap());
if path.exists() {
includes.push(path);
if let Ok(path) = include.target().to_file_path() {
if path.exists() {
includes.push(path);
}
}
}
}
Expand All @@ -117,17 +118,12 @@ impl Workspace {
}
}

#[derive(Debug, Default)]
pub struct WorkspaceManager {
workspace: Mutex<Arc<Workspace>>,
}

impl WorkspaceManager {
pub fn new() -> Self {
WorkspaceManager {
workspace: Mutex::new(Arc::new(Workspace::default())),
}
}

pub fn get(&self) -> Arc<Workspace> {
let workspace = self.workspace.lock().unwrap();
Arc::clone(&workspace)
Expand Down

0 comments on commit 0820d5a

Please sign in to comment.