diff --git a/justfile b/justfile index f25e719c..2518a92f 100755 --- a/justfile +++ b/justfile @@ -15,7 +15,7 @@ test: ci: build-book cargo test --all - cargo clippy --all --all-targets + cargo clippy --all --all-targets -- --deny warnings cargo fmt --all -- --check ./bin/forbid cargo update --locked --package just diff --git a/src/config.rs b/src/config.rs index 1e6e86d1..682229bc 100644 --- a/src/config.rs +++ b/src/config.rs @@ -616,7 +616,7 @@ impl Config { }; let unstable = matches.is_present(arg::UNSTABLE) - || std::env::var_os("JUST_UNSTABLE") + || env::var_os("JUST_UNSTABLE") .map(|val| !(val == "false" || val == "0" || val.is_empty())) .unwrap_or_default(); @@ -662,7 +662,7 @@ impl Config { pub(crate) fn run(self, loader: &Loader) -> Result<(), Error> { if let Err(error) = InterruptHandler::install(self.verbosity) { - warn!("Failed to set CTRL-C handler: {}", error); + warn!("Failed to set CTRL-C handler: {error}"); } self.subcommand.execute(&self, loader) @@ -761,7 +761,7 @@ mod tests { match Config::from_matches(&matches).expect_err("config parsing succeeded") { $error => { $($check)? } - other => panic!("Unexpected config error: {}", other), + other => panic!("Unexpected config error: {other}"), } } } diff --git a/src/evaluator.rs b/src/evaluator.rs index 40db30f6..ac70f6b2 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -210,12 +210,12 @@ impl<'src, 'run> Evaluator<'src, 'run> { cmd.export(self.settings, self.dotenv, &self.scope); - cmd.stdin(process::Stdio::inherit()); + cmd.stdin(Stdio::inherit()); cmd.stderr(if self.config.verbosity.quiet() { - process::Stdio::null() + Stdio::null() } else { - process::Stdio::inherit() + Stdio::inherit() }); InterruptHandler::guard(|| { diff --git a/src/function.rs b/src/function.rs index 81481a97..84c21c03 100644 --- a/src/function.rs +++ b/src/function.rs @@ -337,9 +337,9 @@ fn sha256_file(context: &FunctionContext, path: &str) -> Result let justpath = context.search.working_directory.join(path); let mut hasher = Sha256::new(); let mut file = fs::File::open(&justpath) - .map_err(|err| format!("Failed to open file at `{:?}`: {err}", &justpath.to_str()))?; + .map_err(|err| format!("Failed to open file at `{:?}`: {err}", justpath.to_str()))?; std::io::copy(&mut file, &mut hasher) - .map_err(|err| format!("Failed to read file at `{:?}`: {err}", &justpath.to_str()))?; + .map_err(|err| format!("Failed to read file at `{:?}`: {err}", justpath.to_str()))?; let hash = hasher.finalize(); Ok(format!("{hash:x}")) } diff --git a/src/interrupt_handler.rs b/src/interrupt_handler.rs index 40e31be2..1105954b 100644 --- a/src/interrupt_handler.rs +++ b/src/interrupt_handler.rs @@ -26,7 +26,7 @@ impl InterruptHandler { } .color_display(Color::auto().stderr()) ); - std::process::exit(EXIT_FAILURE); + process::exit(EXIT_FAILURE); } } } @@ -69,7 +69,7 @@ impl InterruptHandler { .color_display(Color::auto().stderr()) ); } - std::process::exit(EXIT_FAILURE); + process::exit(EXIT_FAILURE); } self.blocks -= 1; diff --git a/src/lexer.rs b/src/lexer.rs index aaa3bbdc..b175a97d 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -729,7 +729,7 @@ impl<'src> Lexer<'src> { } self.token(Whitespace); } else if let Some(character) = self.next { - return Err(self.error(CompileErrorKind::InvalidEscapeSequence { character })); + return Err(self.error(InvalidEscapeSequence { character })); } Ok(()) diff --git a/src/lib.rs b/src/lib.rs index db8f5541..fa4b4e60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,7 @@ pub(crate) use { rc::Rc, str::{self, Chars}, sync::{Mutex, MutexGuard}, - usize, vec, + vec, }, { camino::Utf8Path, diff --git a/src/output.rs b/src/output.rs index f447ccc9..af8ec6a8 100644 --- a/src/output.rs +++ b/src/output.rs @@ -15,7 +15,7 @@ pub(crate) fn output(mut command: Command) -> Result { None => OutputError::Unknown, }); } - match std::str::from_utf8(&output.stdout) { + match str::from_utf8(&output.stdout) { Err(error) => Err(OutputError::Utf8(error)), Ok(utf8) => Ok( if utf8.ends_with('\n') { diff --git a/src/output_error.rs b/src/output_error.rs index 1b92ed49..797d3a11 100644 --- a/src/output_error.rs +++ b/src/output_error.rs @@ -11,11 +11,11 @@ pub(crate) enum OutputError { /// Unknown failure Unknown, /// Stdout not UTF-8 - Utf8(std::str::Utf8Error), + Utf8(str::Utf8Error), } impl Display for OutputError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { match *self { Self::Code(code) => write!(f, "Process exited with status code {code}"), Self::Io(ref io_error) => write!(f, "Error executing process: {io_error}"), diff --git a/src/platform.rs b/src/platform.rs index 9fd9b161..36be7fc7 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -33,7 +33,7 @@ impl PlatformInterface for Platform { fs::set_permissions(path, permissions) } - fn signal_from_exit_status(exit_status: process::ExitStatus) -> Option { + fn signal_from_exit_status(exit_status: ExitStatus) -> Option { use std::os::unix::process::ExitStatusExt; exit_status.signal() } diff --git a/src/platform_interface.rs b/src/platform_interface.rs index 0028e09d..4a984ffb 100644 --- a/src/platform_interface.rs +++ b/src/platform_interface.rs @@ -14,7 +14,7 @@ pub(crate) trait PlatformInterface { /// Extract the signal from a process exit status, if it was terminated by a /// signal - fn signal_from_exit_status(exit_status: process::ExitStatus) -> Option; + fn signal_from_exit_status(exit_status: ExitStatus) -> Option; /// Translate a path from a "native" path to a path the interpreter expects fn convert_native_path(working_directory: &Path, path: &Path) -> Result; diff --git a/src/recipe.rs b/src/recipe.rs index c1fa22f3..407115d7 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -49,7 +49,7 @@ impl<'src, D> Recipe<'src, D> { pub(crate) fn max_arguments(&self) -> usize { if self.parameters.iter().any(|p| p.kind.is_variadic()) { - usize::max_value() - 1 + usize::MAX - 1 } else { self.parameters.len() } diff --git a/src/subcommand.rs b/src/subcommand.rs index 2d8c4652..b58cc9a3 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -99,7 +99,7 @@ impl Subcommand { let starting_path = match &config.search_config { SearchConfig::FromInvocationDirectory => config.invocation_directory.clone(), SearchConfig::FromSearchDirectory { search_directory } => { - std::env::current_dir().unwrap().join(search_directory) + env::current_dir().unwrap().join(search_directory) } _ => unreachable!(), }; diff --git a/src/testing.rs b/src/testing.rs index 4f3a9135..4085721c 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -108,7 +108,7 @@ macro_rules! run_error { ).expect_err("Expected runtime error") { $error => $check other => { - panic!("Unexpected run error: {:?}", other); + panic!("Unexpected run error: {other:?}"); } } } else { diff --git a/src/thunk.rs b/src/thunk.rs index 353e3c90..87929735 100644 --- a/src/thunk.rs +++ b/src/thunk.rs @@ -56,7 +56,7 @@ impl<'src> Thunk<'src> { name: Name<'src>, mut arguments: Vec>, ) -> CompileResult<'src, Thunk<'src>> { - crate::function::get(name.lexeme()).map_or( + function::get(name.lexeme()).map_or( Err(name.error(CompileErrorKind::UnknownFunction { function: name.lexeme(), })), diff --git a/src/verbosity.rs b/src/verbosity.rs index 562ae9df..0461a505 100644 --- a/src/verbosity.rs +++ b/src/verbosity.rs @@ -40,6 +40,6 @@ impl Verbosity { } pub const fn default() -> Self { - Self::Taciturn + Taciturn } } diff --git a/tests/choose.rs b/tests/choose.rs index 153a7041..ff224257 100644 --- a/tests/choose.rs +++ b/tests/choose.rs @@ -101,7 +101,7 @@ fn skip_recipes_that_require_arguments() { #[test] fn no_choosable_recipes() { - crate::test::Test::new() + Test::new() .arg("--choose") .justfile( " @@ -200,7 +200,7 @@ fn default() { }; let cat = which("cat").unwrap(); - let fzf = tmp.path().join(format!("fzf{}", env::consts::EXE_SUFFIX)); + let fzf = tmp.path().join(format!("fzf{EXE_SUFFIX}")); #[cfg(unix)] std::os::unix::fs::symlink(cat, fzf).unwrap(); diff --git a/tests/edit.rs b/tests/edit.rs index 75010d32..38f59dbb 100644 --- a/tests/edit.rs +++ b/tests/edit.rs @@ -116,7 +116,7 @@ fn editor_precedence() { assert_stdout(&output, JUSTFILE); let cat = which("cat").unwrap(); - let vim = tmp.path().join(format!("vim{}", EXE_SUFFIX)); + let vim = tmp.path().join(format!("vim{EXE_SUFFIX}")); #[cfg(unix)] std::os::unix::fs::symlink(cat, vim).unwrap(); diff --git a/tests/search.rs b/tests/search.rs index 67fa7f23..daac5bf5 100644 --- a/tests/search.rs +++ b/tests/search.rs @@ -120,7 +120,7 @@ fn test_downwards_multiple_path_argument() { } #[test] -fn single_downards() { +fn single_downwards() { let tmp = temptree! { justfile: "default:\n\techo ok", child: {}, diff --git a/tests/shell.rs b/tests/shell.rs index 30396e40..a55fb10b 100644 --- a/tests/shell.rs +++ b/tests/shell.rs @@ -23,7 +23,7 @@ fn flag() { #[cfg(not(windows))] { let permissions = std::os::unix::fs::PermissionsExt::from_mode(0o700); - std::fs::set_permissions(&shell, permissions).unwrap(); + fs::set_permissions(&shell, permissions).unwrap(); } let output = Command::new(executable_path("just")) diff --git a/tests/tempdir.rs b/tests/tempdir.rs index 72e50212..2e48c9c5 100644 --- a/tests/tempdir.rs +++ b/tests/tempdir.rs @@ -1,6 +1,6 @@ use super::*; -pub(crate) fn tempdir() -> tempfile::TempDir { +pub(crate) fn tempdir() -> TempDir { tempfile::Builder::new() .prefix("just-test-tempdir") .tempdir() diff --git a/www/index.css b/www/index.css index a14147ef..161afa34 100644 --- a/www/index.css +++ b/www/index.css @@ -33,10 +33,7 @@ a:hover { body { display: grid; grid-template-columns: repeat(4, 1fr); - margin-bottom: var(--margin-vertical); - margin-left: var(--margin-horizontal); - margin-right: var(--margin-horizontal); - margin-top: var(--margin-vertical); + margin: var(--margin-vertical) var(--margin-horizontal); } body > * {