Change MSRV to 1.46.0 (#968)

This commit is contained in:
Casey Rodarmor 2021-09-16 17:51:45 +03:00 committed by GitHub
parent 629c75ff04
commit 09af9bb5e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 44 additions and 93 deletions

2
Cargo.lock generated
View File

@ -1,7 +1,5 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.18" version = "0.7.18"

View File

@ -11,7 +11,6 @@ edition = "2018"
autotests = false autotests = false
categories = ["command-line-utilities", "development-tools"] categories = ["command-line-utilities", "development-tools"]
keywords = ["command-line", "task", "runner", "development", "utility"] keywords = ["command-line", "task", "runner", "development", "utility"]
resolver = "2"
[workspace] [workspace]
members = [".", "bin/ref-type"] members = [".", "bin/ref-type"]

View File

@ -1661,6 +1661,10 @@ https://github.com/casey/janus[Janus] is a tool that collects and analyzes justf
Before merging a particularly large or gruesome change, Janus should be run to make sure that nothing breaks. Don't worry about running Janus yourself, Casey will happily run it for you on changes that need it. Before merging a particularly large or gruesome change, Janus should be run to make sure that nothing breaks. Don't worry about running Janus yourself, Casey will happily run it for you on changes that need it.
=== Minimum Supported Rust Version
The minimum supported Rust version, or MSRV, can be found in link:rust-toolchain[].
== Frequently Asked Questions == Frequently Asked Questions
=== What are the idiosyncrasies of Make that Just avoids? === What are the idiosyncrasies of Make that Just avoids?

View File

@ -1 +1 @@
1.52.1 1.46.0

View File

@ -466,10 +466,7 @@ impl Config {
overrides, overrides,
} }
} else if let Some(values) = matches.values_of_os(cmd::COMMAND) { } else if let Some(values) = matches.values_of_os(cmd::COMMAND) {
let mut arguments = values let mut arguments = values.map(OsStr::to_owned).collect::<Vec<OsString>>();
.into_iter()
.map(OsStr::to_owned)
.collect::<Vec<OsString>>();
Subcommand::Command { Subcommand::Command {
binary: arguments.remove(0), binary: arguments.remove(0),
arguments, arguments,

View File

@ -257,12 +257,7 @@ impl<'src> Lexer<'src> {
/// True if `text` could be an identifier /// True if `text` could be an identifier
pub(crate) fn is_identifier(text: &str) -> bool { pub(crate) fn is_identifier(text: &str) -> bool {
if !text if !text.chars().next().map_or(false, Self::is_identifier_start) {
.chars()
.next()
.map(Self::is_identifier_start)
.unwrap_or(false)
{
return false; return false;
} }
@ -496,11 +491,9 @@ impl<'src> Lexer<'src> {
'}' => self.lex_delimiter(BraceR), '}' => self.lex_delimiter(BraceR),
'+' => self.lex_single(Plus), '+' => self.lex_single(Plus),
'#' => self.lex_comment(), '#' => self.lex_comment(),
' ' => self.lex_whitespace(), ' ' | '\t' => self.lex_whitespace(),
'`' | '"' | '\'' => self.lex_string(), '`' | '"' | '\'' => self.lex_string(),
'\n' => self.lex_eol(), '\n' | '\r' => self.lex_eol(),
'\r' => self.lex_eol(),
'\t' => self.lex_whitespace(),
_ if Self::is_identifier_start(start) => self.lex_identifier(), _ if Self::is_identifier_start(start) => self.lex_identifier(),
_ => { _ => {
self.advance()?; self.advance()?;

View File

@ -1,43 +1,14 @@
#![deny(clippy::all, clippy::pedantic, clippy::restriction)] #![deny(clippy::all, clippy::pedantic)]
#![allow( #![allow(
clippy::blanket_clippy_restriction_lints,
clippy::comparison_chain,
clippy::create_dir,
clippy::default_numeric_fallback,
clippy::else_if_without_else,
clippy::enum_glob_use, clippy::enum_glob_use,
clippy::exhaustive_enums,
clippy::exhaustive_structs,
clippy::expect_used,
clippy::filter_map,
clippy::if_not_else, clippy::if_not_else,
clippy::implicit_return,
clippy::indexing_slicing,
clippy::integer_arithmetic,
clippy::let_underscore_must_use,
clippy::map_unwrap_or,
clippy::match_same_arms,
clippy::missing_docs_in_private_items,
clippy::missing_errors_doc, clippy::missing_errors_doc,
clippy::missing_inline_in_public_items,
clippy::needless_lifetimes, clippy::needless_lifetimes,
clippy::needless_pass_by_value, clippy::needless_pass_by_value,
clippy::non_ascii_literal, clippy::non_ascii_literal,
clippy::option_if_let_else,
clippy::panic,
clippy::panic_in_result_fn,
clippy::pattern_type_mismatch,
clippy::print_stdout,
clippy::shadow_unrelated, clippy::shadow_unrelated,
clippy::string_add,
clippy::struct_excessive_bools, clippy::struct_excessive_bools,
clippy::too_many_lines, clippy::too_many_lines,
clippy::unnecessary_wraps,
clippy::unreachable,
clippy::unwrap_in_result,
clippy::unwrap_used,
clippy::use_debug,
clippy::wildcard_enum_match_arm,
clippy::wildcard_imports clippy::wildcard_imports
)] )]

View File

@ -48,8 +48,7 @@ fn load_from_file(
&& config.dotenv_filename.is_none() && config.dotenv_filename.is_none()
&& config.dotenv_path.is_none() && config.dotenv_path.is_none()
&& !std::env::var_os("JUST_SUPPRESS_DOTENV_LOAD_WARNING") && !std::env::var_os("JUST_SUPPRESS_DOTENV_LOAD_WARNING")
.map(|val| val.as_os_str().to_str() == Some("1")) .map_or(false, |val| val.as_os_str().to_str() == Some("1"))
.unwrap_or(false)
{ {
eprintln!( eprintln!(
"{}", "{}",

View File

@ -637,7 +637,7 @@ impl<'tokens, 'src> Parser<'tokens, 'src> {
Ok(Recipe { Ok(Recipe {
parameters: positional.into_iter().chain(variadic).collect(), parameters: positional.into_iter().chain(variadic).collect(),
private: name.lexeme().starts_with('_'), private: name.lexeme().starts_with('_'),
shebang: body.first().map(Line::is_shebang).unwrap_or(false), shebang: body.first().map_or(false, Line::is_shebang),
priors, priors,
body, body,
dependencies, dependencies,
@ -700,7 +700,7 @@ impl<'tokens, 'src> Parser<'tokens, 'src> {
} }
} }
while lines.last().map(Line::is_empty).unwrap_or(false) { while lines.last().map_or(false, Line::is_empty) {
lines.pop(); lines.pop();
} }

View File

@ -75,17 +75,15 @@ impl Positional {
/// Parse an override from a value of the form `NAME=.*`. /// Parse an override from a value of the form `NAME=.*`.
fn override_from_value(value: &str) -> Option<(String, String)> { fn override_from_value(value: &str) -> Option<(String, String)> {
if let Some(equals) = value.find('=') { let equals = value.find('=')?;
let (identifier, equals_value) = value.split_at(equals);
// exclude `=` from value let (identifier, equals_value) = value.split_at(equals);
let value = &equals_value[1..];
if Lexer::is_identifier(identifier) { // exclude `=` from value
Some((identifier.to_owned(), value.to_owned())) let value = &equals_value[1..];
} else {
None if Lexer::is_identifier(identifier) {
} Some((identifier.to_owned(), value.to_owned()))
} else { } else {
None None
} }

View File

@ -212,11 +212,8 @@ impl<'src, D> Recipe<'src, D> {
} }
let mut evaluated = String::new(); let mut evaluated = String::new();
let mut continued = false; let mut continued = false;
let quiet_command = lines.peek().map(|line| line.is_quiet()).unwrap_or(false); let quiet_command = lines.peek().map_or(false, |line| line.is_quiet());
let infallable_command = lines let infallable_command = lines.peek().map_or(false, |line| line.is_infallable());
.peek()
.map(|line| line.is_infallable())
.unwrap_or(false);
loop { loop {
if lines.peek().is_none() { if lines.peek().is_none() {
break; break;

View File

@ -36,10 +36,8 @@ impl<'src, 'run> Scope<'src, 'run> {
pub(crate) fn value(&self, name: &str) -> Option<&str> { pub(crate) fn value(&self, name: &str) -> Option<&str> {
if let Some(binding) = self.bindings.get(name) { if let Some(binding) = self.bindings.get(name) {
Some(binding.value.as_ref()) Some(binding.value.as_ref())
} else if let Some(parent) = self.parent {
parent.value(name)
} else { } else {
None self.parent?.value(name)
} }
} }

View File

@ -134,10 +134,10 @@ impl Search {
} }
} }
if candidates.len() == 1 { match candidates.len() {
return Ok(candidates.into_iter().next().unwrap()); 0 => {}
} else if candidates.len() > 1 { 1 => return Ok(candidates.into_iter().next().unwrap()),
return Err(SearchError::MultipleCandidates { candidates }); _ => return Err(SearchError::MultipleCandidates { candidates }),
} }
} }

View File

@ -17,9 +17,9 @@ pub(crate) struct Shell<'src> {
impl<'src> Display for Setting<'src> { impl<'src> Display for Setting<'src> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
match self { match self {
Setting::DotenvLoad(value) => write!(f, "{}", value), Setting::DotenvLoad(value) | Setting::Export(value) | Setting::PositionalArguments(value) => {
Setting::Export(value) => write!(f, "{}", value), write!(f, "{}", value)
Setting::PositionalArguments(value) => write!(f, "{}", value), }
Setting::Shell(shell) => write!(f, "{}", shell), Setting::Shell(shell) => write!(f, "{}", shell),
} }
} }

View File

@ -33,8 +33,8 @@ impl<'line> Shebang<'line> {
fn interpreter_filename(&self) -> &str { fn interpreter_filename(&self) -> &str {
self self
.interpreter .interpreter
.rsplit_once(|c| matches!(c, '/' | '\\')) .split(|c| matches!(c, '/' | '\\'))
.map(|(_path, filename)| filename) .last()
.unwrap_or(self.interpreter) .unwrap_or(self.interpreter)
} }

View File

@ -73,9 +73,10 @@ impl Subcommand {
Choose { overrides, chooser } => { Choose { overrides, chooser } => {
Self::choose(config, justfile, &search, overrides, chooser.as_deref())?; Self::choose(config, justfile, &search, overrides, chooser.as_deref())?;
} }
Command { overrides, .. } => justfile.run(config, &search, overrides, &[])?, Command { overrides, .. } | Evaluate { overrides, .. } => {
justfile.run(config, &search, overrides, &[])?
}
Dump => Self::dump(ast), Dump => Self::dump(ast),
Evaluate { overrides, .. } => justfile.run(config, &search, overrides, &[])?,
Format => Self::format(config, ast, &search)?, Format => Self::format(config, ast, &search)?,
List => Self::list(config, justfile), List => Self::list(config, justfile),
Run { Run {

View File

@ -43,11 +43,8 @@ impl<'key, V: Keyed<'key>> Table<'key, V> {
} }
pub(crate) fn pop(&mut self) -> Option<V> { pub(crate) fn pop(&mut self) -> Option<V> {
if let Some(key) = self.map.keys().next().copied() { let key = self.map.keys().next().copied()?;
self.map.remove(key) self.map.remove(key)
} else {
None
}
} }
pub(crate) fn remove(&mut self, key: &str) -> Option<V> { pub(crate) fn remove(&mut self, key: &str) -> Option<V> {

View File

@ -33,8 +33,11 @@ impl<'src> Thunk<'src> {
name: Name<'src>, name: Name<'src>,
mut arguments: Vec<Expression<'src>>, mut arguments: Vec<Expression<'src>>,
) -> CompileResult<'src, Thunk<'src>> { ) -> CompileResult<'src, Thunk<'src>> {
if let Some(function) = crate::function::TABLE.get(&name.lexeme()) { crate::function::TABLE.get(&name.lexeme()).map_or(
match (function, arguments.len()) { Err(name.error(CompileErrorKind::UnknownFunction {
function: name.lexeme(),
})),
|function| match (function, arguments.len()) {
(Function::Nullary(function), 0) => Ok(Thunk::Nullary { (Function::Nullary(function), 0) => Ok(Thunk::Nullary {
function: *function, function: *function,
name, name,
@ -68,12 +71,8 @@ impl<'src> Thunk<'src> {
found: arguments.len(), found: arguments.len(),
expected: function.argc(), expected: function.argc(),
})), })),
} },
} else { )
Err(name.error(CompileErrorKind::UnknownFunction {
function: name.lexeme(),
}))
}
} }
} }