minor: import Either from either

This commit is contained in:
Ryo Yoshida 2023-02-25 21:50:27 +09:00
parent f5401f6206
commit cf0c8fe000
No known key found for this signature in database
GPG key ID: E25698A930586171
10 changed files with 13 additions and 9 deletions

2
Cargo.lock generated
View file

@ -572,6 +572,7 @@ dependencies = [
"chalk-recursive", "chalk-recursive",
"chalk-solve", "chalk-solve",
"cov-mark", "cov-mark",
"either",
"ena", "ena",
"expect-test", "expect-test",
"hir-def", "hir-def",
@ -1714,6 +1715,7 @@ name = "syntax"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"cov-mark", "cov-mark",
"either",
"expect-test", "expect-test",
"indexmap", "indexmap",
"itertools", "itertools",

View file

@ -18,6 +18,7 @@ arrayvec = "0.7.2"
bitflags = "1.3.2" bitflags = "1.3.2"
smallvec.workspace = true smallvec.workspace = true
ena = "0.14.0" ena = "0.14.0"
either = "1.7.0"
tracing = "0.1.35" tracing = "0.1.35"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
scoped-tls = "1.0.0" scoped-tls = "1.0.0"

View file

@ -5,11 +5,11 @@
use std::fmt; use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use either::Either;
use hir_def::lang_item::LangItem; use hir_def::lang_item::LangItem;
use hir_def::{resolver::HasResolver, AdtId, AssocItemId, DefWithBodyId, HasModule}; use hir_def::{resolver::HasResolver, AdtId, AssocItemId, DefWithBodyId, HasModule};
use hir_def::{ItemContainerId, Lookup}; use hir_def::{ItemContainerId, Lookup};
use hir_expand::name; use hir_expand::name;
use itertools::Either;
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use typed_arena::Arena; use typed_arena::Arena;

View file

@ -17,6 +17,7 @@ use std::ops::Index;
use std::sync::Arc; use std::sync::Arc;
use chalk_ir::{cast::Cast, ConstValue, DebruijnIndex, Mutability, Safety, Scalar, TypeFlags}; use chalk_ir::{cast::Cast, ConstValue, DebruijnIndex, Mutability, Safety, Scalar, TypeFlags};
use either::Either;
use hir_def::{ use hir_def::{
body::Body, body::Body,
builtin_type::{BuiltinInt, BuiltinType, BuiltinUint}, builtin_type::{BuiltinInt, BuiltinType, BuiltinUint},
@ -31,7 +32,6 @@ use hir_def::{
ItemContainerId, Lookup, TraitId, TypeAliasId, VariantId, ItemContainerId, Lookup, TraitId, TypeAliasId, VariantId,
}; };
use hir_expand::name::name; use hir_expand::name::name;
use itertools::Either;
use la_arena::ArenaMap; use la_arena::ArenaMap;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use stdx::always; use stdx::always;

View file

@ -42,9 +42,9 @@ use chalk_ir::{
visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor}, visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor},
NoSolution, TyData, NoSolution, TyData,
}; };
use either::Either;
use hir_def::{expr::ExprId, type_ref::Rawness, TypeOrConstParamId}; use hir_def::{expr::ExprId, type_ref::Rawness, TypeOrConstParamId};
use hir_expand::name; use hir_expand::name;
use itertools::Either;
use la_arena::{Arena, Idx}; use la_arena::{Arena, Idx};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use traits::FnTrait; use traits::FnTrait;

View file

@ -16,6 +16,7 @@ use chalk_ir::{
cast::Cast, fold::Shift, fold::TypeFoldable, interner::HasInterner, Mutability, Safety, cast::Cast, fold::Shift, fold::TypeFoldable, interner::HasInterner, Mutability, Safety,
}; };
use either::Either;
use hir_def::{ use hir_def::{
adt::StructKind, adt::StructKind,
body::{Expander, LowerCtx}, body::{Expander, LowerCtx},
@ -35,7 +36,6 @@ use hir_def::{
}; };
use hir_expand::{name::Name, ExpandResult}; use hir_expand::{name::Name, ExpandResult};
use intern::Interned; use intern::Interned;
use itertools::Either;
use la_arena::{Arena, ArenaMap}; use la_arena::{Arena, ArenaMap};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use smallvec::SmallVec; use smallvec::SmallVec;
@ -1583,10 +1583,10 @@ pub(crate) fn generic_defaults_recover(
.iter_id() .iter_id()
.map(|id| { .map(|id| {
let val = match id { let val = match id {
itertools::Either::Left(_) => { Either::Left(_) => {
GenericArgData::Ty(TyKind::Error.intern(Interner)).intern(Interner) 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) crate::make_binders(db, &generic_params, val)
}) })

View file

@ -5,6 +5,7 @@ use std::iter;
use base_db::CrateId; use base_db::CrateId;
use chalk_ir::{cast::Cast, fold::Shift, BoundVar, DebruijnIndex}; use chalk_ir::{cast::Cast, fold::Shift, BoundVar, DebruijnIndex};
use either::Either;
use hir_def::{ use hir_def::{
db::DefDatabase, db::DefDatabase,
generics::{ generics::{
@ -19,7 +20,6 @@ use hir_def::{
}; };
use hir_expand::name::Name; use hir_expand::name::Name;
use intern::Interned; use intern::Interned;
use itertools::Either;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};

View file

@ -14,6 +14,7 @@ doctest = false
[dependencies] [dependencies]
cov-mark = "2.0.0-pre.1" cov-mark = "2.0.0-pre.1"
either = "1.7.0"
itertools = "0.10.5" itertools = "0.10.5"
rowan = "0.15.10" rowan = "0.15.10"
rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" } rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" }

View file

@ -13,7 +13,7 @@ pub mod prec;
use std::marker::PhantomData; use std::marker::PhantomData;
use itertools::Either; use either::Either;
use crate::{ use crate::{
syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken}, syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken},

View file

@ -1,7 +1,7 @@
//! Various traits that are implemented by ast nodes. //! Various traits that are implemented by ast nodes.
//! //!
//! The implementations are usually trivial, and live in generated.rs //! The implementations are usually trivial, and live in generated.rs
use itertools::Either; use either::Either;
use crate::{ use crate::{
ast::{self, support, AstChildren, AstNode, AstToken}, ast::{self, support, AstChildren, AstNode, AstToken},