Skip to content

Commit 7e7ff86

Browse files
committed
Remove unused imports
1 parent 125d8c6 commit 7e7ff86

21 files changed

+56
-123
lines changed

crates/hir-def/src/expr_store.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,19 @@ use la_arena::{Arena, ArenaMap};
1818
use rustc_hash::FxHashMap;
1919
use smallvec::SmallVec;
2020
use span::{Edition, MacroFileId, SyntaxContext};
21-
use syntax::{
22-
AstPtr, SyntaxNodePtr,
23-
ast::{self, HasGenericParams},
24-
};
21+
use syntax::{AstPtr, SyntaxNodePtr, ast};
2522
use triomphe::Arc;
2623
use tt::TextRange;
2724

2825
use crate::{
29-
BlockId, GenericDefId, SyntheticSyntax,
26+
BlockId, SyntheticSyntax,
3027
db::DefDatabase,
3128
expr_store::path::Path,
3229
hir::{
3330
Array, AsmOperand, Binding, BindingId, Expr, ExprId, ExprOrPatId, Label, LabelId, Pat,
3431
PatId, RecordFieldPat, Statement,
3532
},
3633
nameres::DefMap,
37-
src::HasSource,
3834
type_ref::{PathId, TypeRef, TypeRefId},
3935
};
4036

crates/hir-def/src/expr_store/body.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use std::ops;
44

55
use hir_expand::{InFile, Lookup};
6-
use la_arena::{Idx, RawIdx};
76
use span::Edition;
87
use syntax::ast;
98
use triomphe::Arc;
@@ -12,11 +11,9 @@ use crate::{
1211
DefWithBodyId, HasModule,
1312
db::DefDatabase,
1413
expr_store::{
15-
ExpressionStore, ExpressionStoreSourceMap, SelfParamPtr, expander::Expander,
16-
lower::lower_body, pretty,
14+
ExpressionStore, ExpressionStoreSourceMap, SelfParamPtr, lower::lower_body, pretty,
1715
},
1816
hir::{BindingId, ExprId, PatId},
19-
item_tree::AttrOwner,
2017
src::HasSource,
2118
};
2219

crates/hir-def/src/expr_store/expander.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
//! Macro expansion utilities.
22
3-
use std::cell::OnceCell;
43
use std::mem;
54

65
use base_db::Crate;
7-
use cfg::CfgOptions;
86
use drop_bomb::DropBomb;
97
use hir_expand::eager::EagerCallBackFn;
108
use hir_expand::{
119
ExpandError, ExpandErrorKind, ExpandResult, HirFileId, InFile, Lookup, MacroCallId,
12-
attrs::RawAttrs, mod_path::ModPath, span_map::SpanMap,
10+
mod_path::ModPath, span_map::SpanMap,
1311
};
1412
use span::{AstIdMap, Edition, SyntaxContext};
15-
use syntax::{AstPtr, Parse, ast};
13+
use syntax::{Parse, ast};
1614
use triomphe::Arc;
1715

18-
use crate::expr_store::path::Path;
1916
use crate::nameres::DefMap;
20-
use crate::{AsMacroCall, MacroId, ModuleId, UnresolvedMacro, attr::Attrs, db::DefDatabase};
17+
use crate::{AsMacroCall, MacroId, UnresolvedMacro, db::DefDatabase};
2118

2219
#[derive(Debug)]
2320
pub(super) struct Expander {

crates/hir-def/src/expr_store/lower.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,35 @@ mod asm;
55
mod generics;
66
mod path;
77

8-
use std::{cell::OnceCell, mem};
8+
use std::mem;
99

10-
use base_db::Crate;
1110
use either::Either;
1211
use hir_expand::{
13-
AstId, InFile, Lookup, MacroDefId,
12+
InFile, Lookup, MacroDefId,
1413
attrs::RawAttrs,
1514
mod_path::tool_path,
1615
name::{AsName, Name},
17-
span_map::{ExpansionSpanMap, SpanMap},
16+
span_map::SpanMap,
1817
};
1918
use intern::{Symbol, sym};
2019
use rustc_hash::FxHashMap;
21-
use span::{AstIdMap, AstIdNode, Edition, EditionedFileId, FileId, HirFileId, RealSpanMap};
20+
use span::HirFileId;
2221
use stdx::never;
2322
use syntax::{
2423
AstNode, AstPtr, AstToken as _, SyntaxNodePtr,
2524
ast::{
2625
self, ArrayExprKind, AstChildren, BlockExpr, HasArgList, HasAttrs, HasGenericArgs,
2726
HasGenericParams, HasLoopBody, HasName, HasTypeBounds, IsString, RangeItem,
28-
SlicePatComponents, make::impl_,
27+
SlicePatComponents,
2928
},
3029
};
3130
use text_size::TextSize;
3231
use thin_vec::ThinVec;
3332
use triomphe::Arc;
3433

3534
use crate::{
36-
AdtId, BlockId, BlockLoc, ConstBlockLoc, DefWithBodyId, FunctionId, GenericDefId, ImplId,
37-
ItemTreeLoc, MacroId, ModuleDefId, ModuleId, StructId, TraitAliasId, TraitId, TypeAliasId,
38-
UnresolvedMacro,
35+
AdtId, BlockId, BlockLoc, DefWithBodyId, FunctionId, GenericDefId, ImplId, ItemTreeLoc,
36+
MacroId, ModuleDefId, ModuleId, TraitAliasId, TraitId, TypeAliasId, UnresolvedMacro,
3937
attr::Attrs,
4038
builtin_type::BuiltinUint,
4139
db::DefDatabase,
@@ -60,8 +58,6 @@ use crate::{
6058
item_tree::FieldsShape,
6159
lang_item::LangItem,
6260
nameres::{DefMap, LocalDefMap, MacroSubNs},
63-
signatures::StructSignature,
64-
src::HasSource,
6561
type_ref::{
6662
ArrayType, ConstRef, FnType, LifetimeRef, Mutability, PathId, Rawness, RefType,
6763
TraitBoundModifier, TraitRef, TypeBound, TypeRef, TypeRefId, UseArgRef,

crates/hir-def/src/expr_store/lower/generics.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,28 @@
33
//! generic parameters. See also the `Generics` type and the `generics_of` query
44
//! in rustc.
55
6-
use std::{ops, sync::LazyLock};
6+
use std::sync::LazyLock;
77

88
use either::Either;
99
use hir_expand::{
10-
ExpandResult,
1110
attrs::RawAttrs,
1211
name::{AsName, Name},
1312
};
1413
use intern::sym;
15-
use la_arena::{Arena, RawIdx};
16-
use stdx::impl_from;
17-
use syntax::ast::{self, HasGenericParams, HasName, HasTypeBounds};
14+
use la_arena::Arena;
15+
use syntax::ast::{self, HasName, HasTypeBounds};
1816
use thin_vec::ThinVec;
1917
use triomphe::Arc;
2018

2119
use crate::{
22-
AdtId, ConstParamId, GenericDefId, HasModule, ItemTreeLoc, LifetimeParamId,
23-
LocalLifetimeParamId, LocalTypeOrConstParamId, Lookup, TypeOrConstParamId, TypeParamId,
20+
GenericDefId, TypeOrConstParamId, TypeParamId,
2421
attr::Attrs,
25-
db::DefDatabase,
2622
expr_store::lower::ExprCollector,
2723
hir::generics::{
2824
ConstParamData, GenericParams, LifetimeParamData, TypeOrConstParamData, TypeParamData,
2925
TypeParamProvenance, WherePredicate, WherePredicateTypeTarget,
3026
},
31-
item_tree::{AttrOwner, FileItemTreeId, ItemTree},
32-
nameres::{DefMap, LocalDefMap, MacroSubNs},
33-
type_ref::{
34-
ArrayType, ConstRef, FnType, LifetimeRef, PathId, RefType, TypeBound, TypeRef, TypeRefId,
35-
},
27+
type_ref::{LifetimeRef, TypeBound, TypeRef, TypeRefId},
3628
};
3729

3830
pub(crate) struct GenericParamsCollector<'db, 'c> {

crates/hir-def/src/expr_store/lower/path.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ mod tests;
55

66
use std::iter;
77

8-
use crate::{
9-
expr_store::{lower::ExprCollector, path::NormalPath},
10-
type_ref::ConstRef,
11-
};
8+
use crate::expr_store::{lower::ExprCollector, path::NormalPath};
129

1310
use hir_expand::{
1411
mod_path::{ModPath, PathKind, resolve_crate_root},
@@ -17,15 +14,13 @@ use hir_expand::{
1714
use intern::{Interned, sym};
1815
use syntax::{
1916
AstPtr,
20-
ast::{self, AstNode, HasGenericArgs, HasTypeBounds},
17+
ast::{self, AstNode, HasGenericArgs},
2118
};
2219
use thin_vec::ThinVec;
2320

2421
use crate::{
25-
expr_store::path::{
26-
AssociatedTypeBinding, GenericArg, GenericArgs, GenericArgsParentheses, Path,
27-
},
28-
type_ref::{LifetimeRef, TypeBound, TypeRef},
22+
expr_store::path::{GenericArg, GenericArgs, Path},
23+
type_ref::{TypeBound, TypeRef},
2924
};
3025

3126
#[cfg(test)]

crates/hir-def/src/expr_store/path.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
//! A desugared representation of paths like `crate::foo` or `<Type as Trait>::bar`.
22
3-
use std::{
4-
fmt::{self, Display},
5-
iter,
6-
};
3+
use std::iter;
74

85
use crate::{
9-
hir::ExprId,
106
lang_item::LangItemTarget,
117
type_ref::{ConstRef, LifetimeRef, TypeBound, TypeRefId},
128
};
139
use hir_expand::{
14-
Intern,
1510
mod_path::{ModPath, PathKind},
1611
name::Name,
1712
};
1813
use intern::Interned;
19-
use span::Edition;
20-
use syntax::ast;
2114

2215
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2316
pub enum Path {

crates/hir-def/src/expr_store/pretty.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! A pretty-printer for HIR.
2+
#![allow(dead_code)]
23

34
use std::{
45
fmt::{self, Write},
@@ -10,15 +11,14 @@ use itertools::Itertools;
1011
use span::Edition;
1112

1213
use crate::{
13-
DefWithBodyId, ItemTreeLoc, TypeOrConstParamId, TypeParamId,
14+
DefWithBodyId, ItemTreeLoc, TypeParamId,
1415
expr_store::path::{GenericArg, GenericArgs},
1516
hir::{
1617
Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, Movability, Statement,
1718
generics::{GenericParams, WherePredicate, WherePredicateTypeTarget},
1819
},
19-
item_tree::FieldsShape,
2020
lang_item::LangItemTarget,
21-
signatures::{FunctionSignature, StructSignature},
21+
signatures::{FnFlags, FunctionSignature, StructSignature},
2222
type_ref::{ConstRef, Mutability, TraitBoundModifier, TypeBound, UseArgRef},
2323
};
2424

@@ -113,7 +113,6 @@ pub(crate) fn print_body_hir(
113113
p.buf
114114
}
115115

116-
#[cfg(test)]
117116
pub(crate) fn print_path(
118117
db: &dyn DefDatabase,
119118
store: &ExpressionStore,
@@ -132,12 +131,12 @@ pub(crate) fn print_path(
132131
p.buf
133132
}
134133

135-
#[cfg(test)]
136134
pub(crate) fn print_struct(
137135
db: &dyn DefDatabase,
138136
StructSignature { name, generic_params, store, flags, shape, repr }: &StructSignature,
139137
edition: Edition,
140138
) -> String {
139+
use crate::item_tree::FieldsShape;
141140
use crate::signatures::StructFlags;
142141

143142
let mut p = Printer {
@@ -182,7 +181,6 @@ pub(crate) fn print_struct(
182181
p.buf
183182
}
184183

185-
#[cfg(test)]
186184
pub(crate) fn print_function(
187185
db: &dyn DefDatabase,
188186
FunctionSignature {
@@ -197,8 +195,6 @@ pub(crate) fn print_function(
197195
}: &FunctionSignature,
198196
edition: Edition,
199197
) -> String {
200-
use crate::signatures::FnFlags;
201-
202198
let mut p = Printer {
203199
db,
204200
store,
@@ -247,7 +243,6 @@ pub(crate) fn print_function(
247243
p.buf
248244
}
249245

250-
#[cfg(test)]
251246
fn print_where_clauses(db: &dyn DefDatabase, generic_params: &GenericParams, p: &mut Printer<'_>) {
252247
if !generic_params.where_predicates.is_empty() {
253248
w!(p, "\nwhere\n");
@@ -258,8 +253,8 @@ fn print_where_clauses(db: &dyn DefDatabase, generic_params: &GenericParams, p:
258253
}
259254
match pred {
260255
WherePredicate::TypeBound { target, bound } => match target {
261-
WherePredicateTypeTarget::TypeRef(idx) => {
262-
p.print_type_ref(*idx);
256+
&WherePredicateTypeTarget::TypeRef(idx) => {
257+
p.print_type_ref(idx);
263258
w!(p, ": ");
264259
p.print_type_bounds(std::slice::from_ref(bound));
265260
}
@@ -312,7 +307,6 @@ fn print_where_clauses(db: &dyn DefDatabase, generic_params: &GenericParams, p:
312307
}
313308
}
314309

315-
#[cfg(test)]
316310
fn print_generic_params(db: &dyn DefDatabase, generic_params: &GenericParams, p: &mut Printer<'_>) {
317311
if !generic_params.is_empty() {
318312
w!(p, "<");

crates/hir-def/src/expr_store/tests/signatures.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use crate::{
2-
DefWithBodyId, ModuleDefId,
2+
GenericDefId, ModuleDefId,
33
expr_store::pretty::{print_function, print_struct},
4-
hir::MatchArm,
54
test_db::TestDB,
65
};
76
use expect_test::{Expect, expect};
8-
use la_arena::RawIdx;
97
use test_fixture::WithFixture;
108

119
use super::super::*;

crates/hir-def/src/find_path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use intern::sym;
1212
use rustc_hash::FxHashSet;
1313

1414
use crate::{
15-
ImportPathConfig, ItemTreeLoc, ModuleDefId, ModuleId,
15+
ImportPathConfig, ModuleDefId, ModuleId,
1616
db::DefDatabase,
1717
item_scope::ItemInNs,
1818
nameres::DefMap,

crates/hir-def/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::ast;
2626
use type_ref::TypeRefId;
2727

2828
use crate::{
29-
BlockId, ConstBlockId,
29+
BlockId,
3030
builtin_type::{BuiltinFloat, BuiltinInt, BuiltinUint},
3131
expr_store::path::{GenericArgs, Path},
3232
type_ref::{Mutability, Rawness},

crates/hir-def/src/hir/type_ref.rs

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
//! HIR for references to types. Paths in these are not yet resolved. They can
22
//! be directly created from an ast::TypeRef, without further queries.
33
4-
use core::fmt;
5-
use std::{fmt::Write, ops::Index};
4+
use std::fmt::Write;
65

7-
use hir_expand::{
8-
AstId, InFile,
9-
db::ExpandDatabase,
10-
name::{AsName, Name},
11-
};
12-
use intern::{Symbol, sym};
13-
use la_arena::{Arena, ArenaMap, Idx};
14-
use rustc_hash::FxHashMap;
15-
use span::Edition;
16-
use syntax::{AstPtr, ast};
6+
use hir_expand::name::Name;
7+
use intern::Symbol;
8+
use la_arena::Idx;
9+
use syntax::ast;
1710
use thin_vec::ThinVec;
1811

1912
use crate::{
20-
SyntheticSyntax, TypeParamId,
13+
TypeParamId,
2114
builtin_type::{BuiltinInt, BuiltinType, BuiltinUint},
2215
expr_store::{
2316
ExpressionStore,
2417
path::{GenericArg, Path},
2518
},
26-
hir::{ExprId, Literal, generics::LocalTypeOrConstParamId},
19+
hir::{ExprId, Literal},
2720
};
2821

2922
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]

0 commit comments

Comments
 (0)