summaryrefslogtreecommitdiff
path: root/support/texlab/src/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/diagnostics')
-rw-r--r--support/texlab/src/diagnostics/build_log.rs3
-rw-r--r--support/texlab/src/diagnostics/chktex.rs4
-rw-r--r--support/texlab/src/diagnostics/debouncer.rs2
-rw-r--r--support/texlab/src/diagnostics/latex.rs8
4 files changed, 8 insertions, 9 deletions
diff --git a/support/texlab/src/diagnostics/build_log.rs b/support/texlab/src/diagnostics/build_log.rs
index 8bd83f695a..e280d862bc 100644
--- a/support/texlab/src/diagnostics/build_log.rs
+++ b/support/texlab/src/diagnostics/build_log.rs
@@ -55,8 +55,7 @@ pub fn analyze_build_log_static(
.relative_path
.to_str()
.and_then(|path| root_document.uri.join(path).map(Into::into).ok())
- .map(Arc::new)
- .unwrap_or_else(|| Arc::clone(&root_document.uri))
+ .map_or_else(|| Arc::clone(&root_document.uri), Arc::new)
} else {
Arc::clone(&root_document.uri)
};
diff --git a/support/texlab/src/diagnostics/chktex.rs b/support/texlab/src/diagnostics/chktex.rs
index 6e7422d8b0..6b6405d975 100644
--- a/support/texlab/src/diagnostics/chktex.rs
+++ b/support/texlab/src/diagnostics/chktex.rs
@@ -54,10 +54,10 @@ pub static LINE_REGEX: Lazy<Regex> =
fn lint(text: &str, current_dir: &Path) -> io::Result<Vec<Diagnostic>> {
let directory = tempdir()?;
fs::write(directory.path().join("file.tex"), text)?;
- let _ = fs::copy(
+ drop(fs::copy(
current_dir.join("chktexrc"),
directory.path().join("chktexrc"),
- );
+ ));
let output = Command::new("chktex")
.args(&["-I0", "-f%l:%c:%d:%k:%n:%m\n", "file.tex"])
diff --git a/support/texlab/src/diagnostics/debouncer.rs b/support/texlab/src/diagnostics/debouncer.rs
index 5117cf2fe0..4c83636856 100644
--- a/support/texlab/src/diagnostics/debouncer.rs
+++ b/support/texlab/src/diagnostics/debouncer.rs
@@ -45,7 +45,7 @@ impl DiagnosticsDebouncer {
.unwrap_or(300);
if let Some(time) = last_task_time_by_uri.get(&document.uri) {
- if time.elapsed().as_millis() < delay as u128 {
+ if time.elapsed().as_millis() < u128::from(delay) {
continue;
}
}
diff --git a/support/texlab/src/diagnostics/latex.rs b/support/texlab/src/diagnostics/latex.rs
index 34d5e9fa29..2c271ad54a 100644
--- a/support/texlab/src/diagnostics/latex.rs
+++ b/support/texlab/src/diagnostics/latex.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use lsp_types::{Diagnostic, DiagnosticSeverity, NumberOrString, Url};
use multimap::MultiMap;
-use rowan::{ast::AstNode, TextRange};
+use rowan::{ast::AstNode, NodeOrToken, TextRange};
use crate::{syntax::latex, Document, LineIndexExt, Workspace};
@@ -20,7 +20,7 @@ pub fn analyze_latex_static(
for node in latex::SyntaxNode::new_root(data.green.clone()).descendants() {
analyze_environment(document, diagnostics_by_uri, node.clone())
- .or_else(|| analyze_curly_group(document, diagnostics_by_uri, node.clone()))
+ .or_else(|| analyze_curly_group(document, diagnostics_by_uri, &node))
.or_else(|| {
if node.kind() == latex::ERROR && node.first_token()?.text() == "}" {
diagnostics_by_uri.insert(
@@ -79,7 +79,7 @@ fn analyze_environment(
fn analyze_curly_group(
document: &Document,
diagnostics_by_uri: &mut MultiMap<Arc<Url>, Diagnostic>,
- node: latex::SyntaxNode,
+ node: &latex::SyntaxNode,
) -> Option<()> {
if !matches!(
node.kind(),
@@ -105,7 +105,7 @@ fn analyze_curly_group(
if !is_inside_verbatim_environment
&& !node
.children_with_tokens()
- .filter_map(|element| element.into_token())
+ .filter_map(NodeOrToken::into_token)
.any(|token| token.kind() == latex::R_CURLY)
{
diagnostics_by_uri.insert(