Skip to content

Commit 765b9a6

Browse files
authored
chore: fix clippy warnings in latest rust beta (jdx#1994)
1 parent 867d02b commit 765b9a6

File tree

10 files changed

+7
-21
lines changed

10 files changed

+7
-21
lines changed

src/cli/args/log_level_arg.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use clap::{Arg, ArgAction};
2-
use log::LevelFilter;
32

43
#[derive(Clone)]
5-
pub struct LogLevelArg(pub LevelFilter);
4+
pub struct LogLevelArg;
65

76
impl LogLevelArg {
87
pub fn arg() -> clap::Arg {

src/cli/args/verbose_arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clap::{Arg, ArgAction};
22

33
#[derive(Clone)]
4-
pub struct VerboseArg(pub u8);
4+
pub struct VerboseArg;
55

66
impl VerboseArg {
77
pub fn arg() -> clap::Arg {

src/cli/args/yes_arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clap::{Arg, ArgAction};
22

3-
pub struct YesArg(pub bool);
3+
pub struct YesArg;
44

55
impl YesArg {
66
pub fn arg() -> Arg {

src/cli/implode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ impl Implode {
5858
}
5959
}
6060

61-
#[cfg(test)]
6261
#[cfg(test)]
6362
mod tests {
6463
use crate::dirs;

src/cmd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ impl<'a> CmdLineRunner<'a> {
223223
self
224224
}
225225

226+
#[allow(clippy::readonly_write_lock)]
226227
pub fn execute(mut self) -> Result<()> {
227228
static RAW_LOCK: RwLock<()> = RwLock::new(());
228229
let read_lock = RAW_LOCK.read().unwrap();

src/file.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> Result<()> {
100100
Ok(())
101101
}
102102

103-
pub fn basename(path: &Path) -> Option<String> {
104-
path.file_name().map(|f| f.to_string_lossy().to_string())
105-
}
106-
107103
/// replaces $HOME with "~"
108104
pub fn display_path<P: AsRef<Path>>(path: P) -> String {
109105
let home = dirs::HOME.to_string_lossy();

src/install_context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ pub struct InstallContext<'a> {
55
pub ts: &'a Toolset,
66
pub tv: ToolVersion,
77
pub pr: Box<dyn SingleReport>,
8-
pub raw: bool,
98
pub force: bool,
109
}

src/plugins/script_manager.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ use crate::config::Settings;
1414
use crate::errors::Error;
1515
use crate::errors::Error::ScriptFailed;
1616
use crate::fake_asdf::get_path_with_fake_asdf;
17-
use crate::file::{basename, display_path};
17+
use crate::file::display_path;
1818
use crate::ui::progress_report::SingleReport;
1919
use crate::{dirs, env};
2020

2121
#[derive(Debug, Clone)]
2222
pub struct ScriptManager {
2323
pub plugin_path: PathBuf,
24-
pub plugin_name: String,
2524
pub env: HashMap<OsString, OsString>,
2625
}
2726

@@ -104,11 +103,7 @@ impl ScriptManager {
104103
// used for testing failure cases
105104
env.insert("MISE_FAILURE".into(), failure);
106105
}
107-
Self {
108-
plugin_name: basename(&plugin_path).expect("invalid plugin path"),
109-
env,
110-
plugin_path,
111-
}
106+
Self { env, plugin_path }
112107
}
113108

114109
pub fn with_env<K, V>(mut self, k: K, v: V) -> Self
@@ -195,7 +190,6 @@ mod tests {
195190
let plugin_path = PathBuf::from("/tmp/asdf");
196191
let script_manager = ScriptManager::new(plugin_path.clone());
197192
assert_eq!(script_manager.plugin_path, plugin_path);
198-
assert_eq!(script_manager.plugin_name, "asdf");
199193
}
200194

201195
#[test]

src/toolset/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ impl Toolset {
187187
ts,
188188
pr: mpr.add(&tv.style()),
189189
tv,
190-
raw,
191190
force: opts.force,
192191
};
193192
t.install_version(ctx)?;

src/ui/progress_report.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ static LONGEST_PLUGIN_NAME: Lazy<usize> = Lazy::new(|| {
5151
.map(|p| p.id().len())
5252
.max()
5353
.unwrap_or_default()
54-
.max(15)
55-
.min(35)
54+
.clamp(15, 35)
5655
});
5756

5857
fn pad_prefix(w: usize, s: &str) -> String {

0 commit comments

Comments
 (0)