Skip to content

Commit 9a4efb4

Browse files
committed
Auto merge of #14202 - lowr:minor/use-either-either, r=lnicola
minor: import `Either` from `either` This is a clean-up patch to replace `use itertools::Either` with `use either::Either` for the sake of consistency.
2 parents f5401f6 + cf0c8fe commit 9a4efb4

File tree

10 files changed

+13
-9
lines changed

10 files changed

+13
-9
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/hir-ty/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ arrayvec = "0.7.2"
1818
bitflags = "1.3.2"
1919
smallvec.workspace = true
2020
ena = "0.14.0"
21+
either = "1.7.0"
2122
tracing = "0.1.35"
2223
rustc-hash = "1.1.0"
2324
scoped-tls = "1.0.0"

crates/hir-ty/src/diagnostics/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use std::fmt;
66
use std::sync::Arc;
77

8+
use either::Either;
89
use hir_def::lang_item::LangItem;
910
use hir_def::{resolver::HasResolver, AdtId, AssocItemId, DefWithBodyId, HasModule};
1011
use hir_def::{ItemContainerId, Lookup};
1112
use hir_expand::name;
12-
use itertools::Either;
1313
use itertools::Itertools;
1414
use rustc_hash::FxHashSet;
1515
use typed_arena::Arena;

crates/hir-ty/src/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::ops::Index;
1717
use std::sync::Arc;
1818

1919
use chalk_ir::{cast::Cast, ConstValue, DebruijnIndex, Mutability, Safety, Scalar, TypeFlags};
20+
use either::Either;
2021
use hir_def::{
2122
body::Body,
2223
builtin_type::{BuiltinInt, BuiltinType, BuiltinUint},
@@ -31,7 +32,6 @@ use hir_def::{
3132
ItemContainerId, Lookup, TraitId, TypeAliasId, VariantId,
3233
};
3334
use hir_expand::name::name;
34-
use itertools::Either;
3535
use la_arena::ArenaMap;
3636
use rustc_hash::FxHashMap;
3737
use stdx::always;

crates/hir-ty/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ use chalk_ir::{
4242
visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor},
4343
NoSolution, TyData,
4444
};
45+
use either::Either;
4546
use hir_def::{expr::ExprId, type_ref::Rawness, TypeOrConstParamId};
4647
use hir_expand::name;
47-
use itertools::Either;
4848
use la_arena::{Arena, Idx};
4949
use rustc_hash::FxHashSet;
5050
use traits::FnTrait;

crates/hir-ty/src/lower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use chalk_ir::{
1616
cast::Cast, fold::Shift, fold::TypeFoldable, interner::HasInterner, Mutability, Safety,
1717
};
1818

19+
use either::Either;
1920
use hir_def::{
2021
adt::StructKind,
2122
body::{Expander, LowerCtx},
@@ -35,7 +36,6 @@ use hir_def::{
3536
};
3637
use hir_expand::{name::Name, ExpandResult};
3738
use intern::Interned;
38-
use itertools::Either;
3939
use la_arena::{Arena, ArenaMap};
4040
use rustc_hash::FxHashSet;
4141
use smallvec::SmallVec;
@@ -1583,10 +1583,10 @@ pub(crate) fn generic_defaults_recover(
15831583
.iter_id()
15841584
.map(|id| {
15851585
let val = match id {
1586-
itertools::Either::Left(_) => {
1586+
Either::Left(_) => {
15871587
GenericArgData::Ty(TyKind::Error.intern(Interner)).intern(Interner)
15881588
}
1589-
itertools::Either::Right(id) => unknown_const_as_generic(db.const_param_ty(id)),
1589+
Either::Right(id) => unknown_const_as_generic(db.const_param_ty(id)),
15901590
};
15911591
crate::make_binders(db, &generic_params, val)
15921592
})

crates/hir-ty/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::iter;
55

66
use base_db::CrateId;
77
use chalk_ir::{cast::Cast, fold::Shift, BoundVar, DebruijnIndex};
8+
use either::Either;
89
use hir_def::{
910
db::DefDatabase,
1011
generics::{
@@ -19,7 +20,6 @@ use hir_def::{
1920
};
2021
use hir_expand::name::Name;
2122
use intern::Interned;
22-
use itertools::Either;
2323
use rustc_hash::FxHashSet;
2424
use smallvec::{smallvec, SmallVec};
2525

crates/syntax/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ doctest = false
1414

1515
[dependencies]
1616
cov-mark = "2.0.0-pre.1"
17+
either = "1.7.0"
1718
itertools = "0.10.5"
1819
rowan = "0.15.10"
1920
rustc_lexer = { version = "727.0.0", package = "rustc-ap-rustc_lexer" }

crates/syntax/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub mod prec;
1313

1414
use std::marker::PhantomData;
1515

16-
use itertools::Either;
16+
use either::Either;
1717

1818
use crate::{
1919
syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken},

crates/syntax/src/ast/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Various traits that are implemented by ast nodes.
22
//!
33
//! The implementations are usually trivial, and live in generated.rs
4-
use itertools::Either;
4+
use either::Either;
55

66
use crate::{
77
ast::{self, support, AstChildren, AstNode, AstToken},

0 commit comments

Comments
 (0)