From 9578280e4e3ca65797891dadcacf6a95b85b2bd2 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 5 Sep 2023 13:26:23 +0930 Subject: [PATCH] Fix linting (#1245) --- Cargo.toml | 3 ++- cmd/ein/Cargo.toml | 2 +- lib/app/Cargo.toml | 2 +- lib/app/src/common/file_path.rs | 11 ++++------- lib/ffi/Cargo.toml | 2 +- lib/ffi/src/arc.rs | 4 ++-- lib/infra/Cargo.toml | 2 +- .../src/compile/transform/let_error_transformer.rs | 6 +++--- lib/lang/src/path/module_path.rs | 2 +- lib/prelude/ffi/Cargo.toml | 2 +- 10 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6af348ca6..6046060a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,11 @@ [workspace] +resolver = "2" members = [ "cmd/ein", "lib/app", "lib/ffi", "lib/infra", "lib/lang", - "lib/prelude/ffi" + "lib/prelude/ffi", ] exclude = ["tmp"] diff --git a/cmd/ein/Cargo.toml b/cmd/ein/Cargo.toml index 72a25316b..7bb1427da 100644 --- a/cmd/ein/Cargo.toml +++ b/cmd/ein/Cargo.toml @@ -2,7 +2,7 @@ name = "ein" version = "0.1.0" authors = ["Yota Toyama "] -edition = "2018" +edition = "2021" [dependencies] app = { path = "../../lib/app" } diff --git a/lib/app/Cargo.toml b/lib/app/Cargo.toml index 8203ba5eb..40bd93fe5 100644 --- a/lib/app/Cargo.toml +++ b/lib/app/Cargo.toml @@ -2,7 +2,7 @@ name = "app" version = "0.1.0" authors = ["Yota Toyama "] -edition = "2018" +edition = "2021" [dependencies] lang = { path = "../lang" } diff --git a/lib/app/src/common/file_path.rs b/lib/app/src/common/file_path.rs index a873fdde2..e3a2f1169 100644 --- a/lib/app/src/common/file_path.rs +++ b/lib/app/src/common/file_path.rs @@ -30,15 +30,12 @@ impl FilePath { format!(".{extension}") }; - Self::new( - self.components().take(self.components.len() - 1).chain( - vec![regex::Regex::new(r"(\..*)?$") + Self::new(self.components().take(self.components.len() - 1).chain( + vec![regex::Regex::new(r"(\..*)?$") .unwrap() .replace(self.components.iter().last().unwrap(), replacement.as_str()) - .deref()] - .into_iter(), - ), - ) + .deref()], + )) } pub fn join(&self, file_path: &Self) -> Self { diff --git a/lib/ffi/Cargo.toml b/lib/ffi/Cargo.toml index d766f75b9..c96cca1f8 100644 --- a/lib/ffi/Cargo.toml +++ b/lib/ffi/Cargo.toml @@ -3,7 +3,7 @@ name = "ein-ffi" description = "FFI library for Ein programming language" version = "0.6.0" publish = true -edition = "2018" +edition = "2021" license = "MIT" authors = ["Yota Toyama "] repository = "https://github.com/ein-lang/ein" diff --git a/lib/ffi/src/arc.rs b/lib/ffi/src/arc.rs index 2cfa8ec60..11eb9ba5d 100644 --- a/lib/ffi/src/arc.rs +++ b/lib/ffi/src/arc.rs @@ -22,7 +22,7 @@ impl Arc { Self { block, - phantom: PhantomData::default(), + phantom: PhantomData, } } } @@ -45,7 +45,7 @@ impl Clone for Arc { fn clone(&self) -> Self { Self { block: self.block.clone(), - phantom: PhantomData::default(), + phantom: PhantomData, } } } diff --git a/lib/infra/Cargo.toml b/lib/infra/Cargo.toml index 9e2ed5143..be052a8e4 100644 --- a/lib/infra/Cargo.toml +++ b/lib/infra/Cargo.toml @@ -2,7 +2,7 @@ name = "infra" version = "0.1.0" authors = ["Yota Toyama "] -edition = "2018" +edition = "2021" [dependencies] app = { path = "../app" } diff --git a/lib/lang/src/compile/transform/let_error_transformer.rs b/lib/lang/src/compile/transform/let_error_transformer.rs index 64b504c9a..c12e2ee16 100644 --- a/lib/lang/src/compile/transform/let_error_transformer.rs +++ b/lib/lang/src/compile/transform/let_error_transformer.rs @@ -39,8 +39,8 @@ impl LetErrorTransformer { let_.source_information().clone(), ); - let_.definitions().iter().rev().fold( - Ok(let_.expression().clone()), + let_.definitions().iter().rev().try_fold( + let_.expression().clone(), |expression, variable_definition| { let ok_type = variable_definition.type_().clone(); @@ -55,7 +55,7 @@ impl LetErrorTransformer { variable_definition.name(), variable_definition.body().clone(), vec![ - Alternative::new(ok_type, expression?), + Alternative::new(ok_type, expression), Alternative::new( error_type.clone(), self.coerce_type( diff --git a/lib/lang/src/path/module_path.rs b/lib/lang/src/path/module_path.rs index f629a894d..608b0a701 100644 --- a/lib/lang/src/path/module_path.rs +++ b/lib/lang/src/path/module_path.rs @@ -56,7 +56,7 @@ impl ModulePath { .into_iter() .chain(self.components.iter()) .map(|component| component.as_str()) - .chain(vec![name].into_iter()) + .chain(vec![name]) .collect::>() .join(".") } diff --git a/lib/prelude/ffi/Cargo.toml b/lib/prelude/ffi/Cargo.toml index 35dfbc78f..a0283a3cc 100644 --- a/lib/prelude/ffi/Cargo.toml +++ b/lib/prelude/ffi/Cargo.toml @@ -2,7 +2,7 @@ name = "prelude" version = "0.1.0" publish = false -edition = "2018" +edition = "2021" [lib] name = "prelude"