From cf0c8fe0003be7bbb4f57dd553f0eb85ec845099 Mon Sep 17 00:00:00 2001 From: Ryo Yoshida Date: Sat, 25 Feb 2023 21:50:27 +0900 Subject: [PATCH] minor: import `Either` from `either` --- Cargo.lock | 2 ++ crates/hir-ty/Cargo.toml | 1 + crates/hir-ty/src/diagnostics/expr.rs | 2 +- crates/hir-ty/src/infer.rs | 2 +- crates/hir-ty/src/lib.rs | 2 +- crates/hir-ty/src/lower.rs | 6 +++--- crates/hir-ty/src/utils.rs | 2 +- crates/syntax/Cargo.toml | 1 + crates/syntax/src/ast.rs | 2 +- crates/syntax/src/ast/traits.rs | 2 +- 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec19776725..fc77515b63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -572,6 +572,7 @@ dependencies = [ "chalk-recursive", "chalk-solve", "cov-mark", + "either", "ena", "expect-test", "hir-def", @@ -1714,6 +1715,7 @@ name = "syntax" version = "0.0.0" dependencies = [ "cov-mark", + "either", "expect-test", "indexmap", "itertools", diff --git a/crates/hir-ty/Cargo.toml b/crates/hir-ty/Cargo.toml index a8b8d5222e..4572e33486 100644 --- a/crates/hir-ty/Cargo.toml +++ b/crates/hir-ty/Cargo.toml @@ -18,6 +18,7 @@ arrayvec = "0.7.2" bitflags = "1.3.2" smallvec.workspace = true ena = "0.14.0" +either = "1.7.0" tracing = "0.1.35" rustc-hash = "1.1.0" scoped-tls = "1.0.0" diff --git a/crates/hir-ty/src/diagnostics/expr.rs b/crates/hir-ty/src/diagnostics/expr.rs index 3286dcb5af..91b4670289 100644 --- a/crates/hir-ty/src/diagnostics/expr.rs +++ b/crates/hir-ty/src/diagnostics/expr.rs @@ -5,11 +5,11 @@ use std::fmt; use std::sync::Arc; +use either::Either; use hir_def::lang_item::LangItem; use hir_def::{resolver::HasResolver, AdtId, AssocItemId, DefWithBodyId, HasModule}; use hir_def::{ItemContainerId, Lookup}; use hir_expand::name; -use itertools::Either; use itertools::Itertools; use rustc_hash::FxHashSet; use typed_arena::Arena; diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs index 767afdf9eb..512ba63dfc 100644 --- a/crates/hir-ty/src/infer.rs +++ b/crates/hir-ty/src/infer.rs @@ -17,6 +17,7 @@ use std::ops::Index; use std::sync::Arc; use chalk_ir::{cast::Cast, ConstValue, DebruijnIndex, Mutability, Safety, Scalar, TypeFlags}; +use either::Either; use hir_def::{ body::Body, builtin_type::{BuiltinInt, BuiltinType, BuiltinUint}, @@ -31,7 +32,6 @@ use hir_def::{ ItemContainerId, Lookup, TraitId, TypeAliasId, VariantId, }; use hir_expand::name::name; -use itertools::Either; use la_arena::ArenaMap; use rustc_hash::FxHashMap; use stdx::always; diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs index 59a5ef8c14..6056043dcd 100644 --- a/crates/hir-ty/src/lib.rs +++ b/crates/hir-ty/src/lib.rs @@ -42,9 +42,9 @@ use chalk_ir::{ visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor}, NoSolution, TyData, }; +use either::Either; use hir_def::{expr::ExprId, type_ref::Rawness, TypeOrConstParamId}; use hir_expand::name; -use itertools::Either; use la_arena::{Arena, Idx}; use rustc_hash::FxHashSet; use traits::FnTrait; diff --git a/crates/hir-ty/src/lower.rs b/crates/hir-ty/src/lower.rs index 2996467372..140ed7f591 100644 --- a/crates/hir-ty/src/lower.rs +++ b/crates/hir-ty/src/lower.rs @@ -16,6 +16,7 @@ use chalk_ir::{ cast::Cast, fold::Shift, fold::TypeFoldable, interner::HasInterner, Mutability, Safety, }; +use either::Either; use hir_def::{ adt::StructKind, body::{Expander, LowerCtx}, @@ -35,7 +36,6 @@ use hir_def::{ }; use hir_expand::{name::Name, ExpandResult}; use intern::Interned; -use itertools::Either; use la_arena::{Arena, ArenaMap}; use rustc_hash::FxHashSet; use smallvec::SmallVec; @@ -1583,10 +1583,10 @@ pub(crate) fn generic_defaults_recover( .iter_id() .map(|id| { let val = match id { - itertools::Either::Left(_) => { + Either::Left(_) => { GenericArgData::Ty(TyKind::Error.intern(Interner)).intern(Interner) } - itertools::Either::Right(id) => unknown_const_as_generic(db.const_param_ty(id)), + Either::Right(id) => unknown_const_as_generic(db.const_param_ty(id)), }; crate::make_binders(db, &generic_params, val) }) diff --git a/crates/hir-ty/src/utils.rs b/crates/hir-ty/src/utils.rs index 70d2d5efa6..f69cb6bacb 100644 --- a/crates/hir-ty/src/utils.rs +++ b/crates/hir-ty/src/utils.rs @@ -5,6 +5,7 @@ use std::iter; use base_db::CrateId; use chalk_ir::{cast::Cast, fold::Shift, BoundVar, DebruijnIndex}; +use either::Either; use hir_def::{ db::DefDatabase, generics::{ @@ -19,7 +20,6 @@ use hir_def::{ }; use hir_expand::name::Name; use intern::Interned; -use itertools::Either; use rustc_hash::FxHashSet; use smallvec::{smallvec, SmallVec}; diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml index 8fc493a23f..305cf2d394 100644 --- a/crates/syntax/Cargo.toml +++ b/crates/syntax/Cargo.toml @@ -14,6 +14,7 @@ doctest = false [dependencies] cov-mark = "2.0.0-pre.1" +either = "1.7.0" itertools = "0.10.5" rowan = "0.15.10" rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" } diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs index 385a4e0a3c..679536fe27 100644 --- a/crates/syntax/src/ast.rs +++ b/crates/syntax/src/ast.rs @@ -13,7 +13,7 @@ pub mod prec; use std::marker::PhantomData; -use itertools::Either; +use either::Either; use crate::{ syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken}, diff --git a/crates/syntax/src/ast/traits.rs b/crates/syntax/src/ast/traits.rs index aa2b7ed5c8..bc7b558231 100644 --- a/crates/syntax/src/ast/traits.rs +++ b/crates/syntax/src/ast/traits.rs @@ -1,7 +1,7 @@ //! Various traits that are implemented by ast nodes. //! //! The implementations are usually trivial, and live in generated.rs -use itertools::Either; +use either::Either; use crate::{ ast::{self, support, AstChildren, AstNode, AstToken},