Opt in to 2021 ed

This commit is contained in:
Félix Saparelli 2021-10-20 00:51:33 +13:00
parent be37349b90
commit 401437784d
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
4 changed files with 8 additions and 10 deletions

View File

@ -14,7 +14,7 @@ repository = "https://github.com/watchexec/watchexec"
readme = "README.md"
rust-version = "1.56.0"
edition = "2018"
edition = "2021"
[[bin]]
name = "watchexec"

View File

@ -13,7 +13,7 @@ repository = "https://github.com/watchexec/watchexec"
readme = "README.md"
rust-version = "1.56.0"
edition = "2018"
edition = "2021"
[dependencies]
async-recursion = "0.3.2"

View File

@ -119,7 +119,7 @@ pub async fn origins(path: impl AsRef<Path>) -> HashSet<PathBuf> {
return false;
}
IntoIterator::into_iter([
[
list.has_dir("_darcs"),
list.has_dir(".bzr"),
list.has_dir(".fossil-settings"),
@ -165,7 +165,8 @@ pub async fn origins(path: impl AsRef<Path>) -> HashSet<PathBuf> {
list.has_file("README"),
list.has_file("requirements.txt"),
list.has_file("v.mod"),
])
]
.into_iter()
.any(|f| f)
}
@ -196,7 +197,7 @@ pub async fn origins(path: impl AsRef<Path>) -> HashSet<PathBuf> {
/// anything for some paths returned by [`origins()`].
pub async fn types(path: impl AsRef<Path>) -> HashSet<ProjectType> {
let list = DirList::obtain(path.as_ref()).await;
IntoIterator::into_iter([
[
list.if_has_dir("_darcs", ProjectType::Darcs),
list.if_has_dir(".bzr", ProjectType::Bazaar),
list.if_has_dir(".fossil-settings", ProjectType::Fossil),
@ -222,7 +223,8 @@ pub async fn types(path: impl AsRef<Path>) -> HashSet<ProjectType> {
list.if_has_file("project.clj", ProjectType::Leiningen),
list.if_has_file("requirements.txt", ProjectType::Pip),
list.if_has_file("v.mod", ProjectType::V),
])
]
.into_iter()
.flatten()
.collect()
}

View File

@ -115,8 +115,6 @@ impl SubSignal {
/// [`Custom`][SubSignal::Custom], as the first-class ones are always supported).
#[cfg(unix)]
pub fn to_nix(self) -> Option<NixSignal> {
use std::convert::TryFrom;
match self {
Self::Hangup => Some(NixSignal::SIGHUP),
Self::ForceStop => Some(NixSignal::SIGKILL),
@ -181,8 +179,6 @@ impl FromStr for SubSignal {
#[cfg(unix)]
fn from_str(s: &str) -> Result<Self, Self::Err> {
use std::convert::TryFrom;
if let Ok(sig) = i32::from_str(s) {
if let Ok(sig) = NixSignal::try_from(sig) {
return Ok(Self::from_nix(sig));