Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: cleanup for clippy #744

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Code for WorkshopModNotFound {
}

fn help(&self) -> Option<String> {
Some(format!("HEMTT does not subscribe to mods, you must subscribe in Steam and allow it to download.\nWorkshop link: https://steamcommunity.com/sharedfiles/filedetails/?id={}", self.id).to_owned())
Some(format!("HEMTT does not subscribe to mods, you must subscribe in Steam and allow it to download.\nWorkshop link: https://steamcommunity.com/sharedfiles/filedetails/?id={}", self.id))
}

fn diagnostic(&self) -> Option<Diagnostic> {
Expand Down
9 changes: 3 additions & 6 deletions bin/src/modules/asc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use hemtt_preprocessor::Processor;
use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use rust_embed::RustEmbed;
use serde::Serialize;
use time::Instant;
use std::time::Instant;

use crate::{context::Context, error::Error, report::Report};

Expand Down Expand Up @@ -136,10 +136,7 @@ impl Module for ArmaScriptCompiler {
})
.collect::<Result<_, Error>>()?;
}
debug!(
"ASC Preprocess took {:?}",
start.elapsed().whole_milliseconds()
);
debug!("ASC Preprocess took {:?}", start.elapsed().as_millis());
for root in root_dirs {
config.add_input_dir(root.to_string());
}
Expand All @@ -163,7 +160,7 @@ impl Module for ArmaScriptCompiler {
warn!("ASC 'Parse Error' - check .hemttout/asc.log");
}
if command.status.success() {
debug!("ASC took {:?}", start.elapsed().whole_milliseconds());
debug!("ASC took {:?}", start.elapsed().as_millis());
} else {
return Err(Error::ArmaScriptCompiler(
String::from_utf8(command.stdout).expect("stdout should be valid utf8"),
Expand Down
2 changes: 2 additions & 0 deletions hls/src/diag_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl DiagManager {
}
}

#[allow(dead_code)]
pub fn current(&self, scope: &str, url: &Url) -> Option<Vec<Diagnostic>> {
self.worker.current(scope, url)
}
Expand All @@ -67,6 +68,7 @@ pub struct DiagWorker {
}

impl DiagWorker {
#[allow(dead_code)]
pub fn current(&self, scope: &str, url: &Url) -> Option<Vec<Diagnostic>> {
self.current
.get(&(scope.to_string(), url.clone()))
Expand Down
1 change: 1 addition & 0 deletions hls/src/positions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use hemtt_workspace::position::LineCol;
use tower_lsp::lsp_types::Position;

pub trait ToPosition {
#[allow(dead_code)]
fn to_position(&self) -> Position;
}

Expand Down
1 change: 1 addition & 0 deletions hls/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl EditorWorkspace {
&self.workspace
}

#[allow(dead_code)]
pub fn url(&self) -> &Url {
&self.url
}
Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ fn deprecated(file: &Path, key: &str, replacement: &str, info: Option<&str>) {
key,
file.display(),
replacement,
info.map(|i| format!("\n {}", i)).unwrap_or_default()
info.map(|i| format!("\n {i}")).unwrap_or_default()
);
}
2 changes: 2 additions & 0 deletions libs/workspace/src/reporting/processed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ pub struct Processed {
/// string offset(start, stop), source, source position
mappings: Vec<Mapping>,

#[allow(dead_code)]
#[cfg(feature = "lsp")]
/// Map of token usage to definition
/// (token, definition)
declarations: HashMap<Position, Position>,

#[allow(dead_code)]
#[cfg(feature = "lsp")]
/// Map of token definition to usage
/// (definition, usages)
Expand Down