Skip to content

Commit de6214d

Browse files
cargo fmt
1 parent 887e059 commit de6214d

File tree

17 files changed

+38
-53
lines changed

17 files changed

+38
-53
lines changed

crates/hir-def/src/macro_expansion_tests/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ use std::{iter, ops::Range, sync};
1919
use base_db::SourceDatabase;
2020
use expect_test::Expect;
2121
use hir_expand::{
22-
InFile, InFile, MacroCallKind, MacroCallKind, MacroFileId, MacroFileId, MacroFileIdExt,
23-
MacroFileIdExt, MacroKind,
22+
InFile, MacroCallKind, MacroFileId, MacroFileIdExt, MacroKind,
2423
db::ExpandDatabase,
2524
proc_macro::{ProcMacro, ProcMacroExpander, ProcMacroExpansionError, ProcMacroKind},
2625
span_map::SpanMapRef,

crates/hir-expand/src/files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use span::{
99
use syntax::{AstNode, AstPtr, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize};
1010

1111
use crate::{
12-
MacroFileIdExt, MacroFileIdExt, MacroKind,
12+
MacroFileIdExt, MacroKind,
1313
db::{self, ExpandDatabase},
1414
map_node_range_up, map_node_range_up_rooted, span_for_offset,
1515
};

crates/hir-ty/src/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub use crate::diagnostics::{
1010
BodyValidationDiagnostic, record_literal_missing_fields, record_pattern_missing_fields,
1111
},
1212
unsafe_check::{
13-
missing_unsafe, unsafe_operations, unsafe_operations_for_body, InsideUnsafeBlock,
14-
UnsafetyReason,
13+
InsideUnsafeBlock, UnsafetyReason, missing_unsafe, unsafe_operations,
14+
unsafe_operations_for_body,
1515
},
1616
};

crates/hir/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ pub use {
130130
{ModuleDefId, TraitId},
131131
},
132132
hir_expand::{
133-
ExpandResult, ExpandResult, HirFileId, HirFileId, HirFileIdExt, HirFileIdExt, MacroFileId,
134-
MacroFileId, MacroFileIdExt, MacroFileIdExt, MacroKind,
133+
ExpandResult, HirFileId, HirFileIdExt, MacroFileId, MacroFileIdExt, MacroKind,
135134
attrs::{Attr, AttrId},
136135
change::ChangeWithProcMacros,
137136
files::{

crates/hir/src/semantics.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212

1313
use either::Either;
1414
use hir_def::{
15+
AsMacroCall, DefWithBodyId, FunctionId, MacroId, StructId, TraitId, VariantId,
1516
expr_store::ExprOrPatSource,
1617
hir::{Expr, ExprOrPatId},
1718
lower::LowerCtx,
@@ -31,7 +32,7 @@ use hir_expand::{
3132
name::AsName,
3233
};
3334
use hir_ty::diagnostics::unsafe_operations_for_body;
34-
use intern::{sym, Symbol};
35+
use intern::{Symbol, sym};
3536
use itertools::Itertools;
3637
use rustc_hash::{FxHashMap, FxHashSet};
3738
use smallvec::{SmallVec, smallvec};
@@ -46,9 +47,6 @@ use syntax::{
4647
use triomphe::Arc;
4748

4849
use crate::{
49-
db::HirDatabase,
50-
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
51-
source_analyzer::{name_hygiene, resolve_hir_path, SourceAnalyzer},
5250
Adjust, Adjustment, Adt, AutoBorrow, BindingMode, BuiltinAttr, Callable, Const, ConstParam,
5351
Crate, DefWithBody, DeriveHelper, Enum, Field, Function, GenericSubstitution, HasSource,
5452
HirFileId, Impl, InFile, InlineAsmOperand, ItemInNs, Label, LifetimeParam, Local, Macro,

crates/hir/src/source_analyzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ use hir_ty::{
3737
Adjustment, InferenceResult, Interner, Substitution, TraitEnvironment, Ty, TyExt, TyKind,
3838
TyLoweringContext,
3939
diagnostics::{
40-
record_literal_missing_fields, record_pattern_missing_fields, unsafe_operations,
41-
InsideUnsafeBlock,
40+
InsideUnsafeBlock, record_literal_missing_fields, record_pattern_missing_fields,
41+
unsafe_operations,
4242
},
4343
from_assoc_type_id,
4444
lang_items::lang_items_for_bin_op,

crates/ide-assists/src/handlers/convert_bool_then.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use syntax::{
1616
use crate::{
1717
AssistContext, AssistId, AssistKind, Assists,
1818
utils::{invert_boolean_expression, unwrap_trivial_block},
19-
utils::{invert_boolean_expression_legacy, unwrap_trivial_block},
2019
};
2120

2221
// Assist: convert_if_to_bool_then

crates/ide-assists/src/handlers/flip_comma.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use syntax::{
2-
AstNode, AstNode, Direction, Direction, NodeOrToken, NodeOrToken, SyntaxElement, SyntaxKind,
3-
SyntaxKind, SyntaxToken, SyntaxToken, T, T,
2+
AstNode, Direction, NodeOrToken, SyntaxKind, SyntaxToken, T,
43
algo::non_trivia_sibling,
54
ast::{self, syntax_factory::SyntaxFactory},
65
syntax_editor::SyntaxMapping,

crates/ide-assists/src/handlers/inline_local_variable.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ use ide_db::{
55
search::{FileReference, FileReferenceNode, UsageSearchResult},
66
};
77
use syntax::{
8-
ast::{self, syntax_factory::SyntaxFactory, AstNode, AstToken, HasName},
98
SyntaxElement, TextRange,
10-
ast::{self, AstNode, AstToken, HasName},
9+
ast::{self, AstNode, AstToken, HasName, syntax_factory::SyntaxFactory},
1110
};
1211

1312
use crate::{

crates/ide-assists/src/handlers/unqualify_method_call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use ide_db::imports::insert_use::ImportScope;
22
use syntax::{
33
TextRange,
4-
ast::{self, AstNode, HasArgList, make},
5-
ast::{self, AstNode, HasArgList, prec::ExprPrecedence},
4+
ast::prec::ExprPrecedence,
5+
ast::{self, AstNode, HasArgList},
66
};
77

88
use crate::{AssistContext, AssistId, AssistKind, Assists};

crates/ide/src/syntax_highlighting.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ use hir::{
2121
use ide_db::{FxHashMap, FxHashSet, Ranker, RootDatabase, SymbolKind};
2222
use span::EditionedFileId;
2323
use syntax::{
24-
AstNode, AstToken, NodeOrToken, SyntaxKind::*, SyntaxNode, SyntaxToken, T, TextRange, WalkEvent,
24+
AstNode, AstToken, NodeOrToken,
25+
SyntaxKind::*,
26+
SyntaxNode, SyntaxToken, T, TextRange, WalkEvent,
27+
ast::{self, IsString},
2528
};
2629

2730
use crate::{

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ use std::ops::ControlFlow;
55
use either::Either;
66
use hir::{AsAssocItem, HasVisibility, MacroFileIdExt, Semantics};
77
use ide_db::{
8-
defs::{Definition, IdentClass, NameClass, NameRefClass},
9-
syntax_helpers::node_ext::walk_pat,
108
FxHashMap, RootDatabase, SymbolKind,
119
defs::{Definition, IdentClass, NameClass, NameRefClass},
10+
syntax_helpers::node_ext::walk_pat,
1211
};
1312
use span::Edition;
1413
use stdx::hash_once;
1514
use syntax::{
16-
ast, match_ast, AstNode, AstPtr, AstToken, NodeOrToken,
15+
AstNode, AstPtr, AstToken, NodeOrToken,
1716
SyntaxKind::{self, *},
18-
SyntaxNode, SyntaxNodePtr, SyntaxToken, T,
17+
SyntaxNode, SyntaxNodePtr, SyntaxToken, T, ast, match_ast,
1918
};
2019

2120
use crate::{
@@ -144,11 +143,7 @@ fn punctuation(
144143
let ptr = operator_parent
145144
.as_ref()
146145
.and_then(|it| AstPtr::try_from_raw(SyntaxNodePtr::new(it)));
147-
if ptr.is_some_and(is_unsafe_node) {
148-
h | HlMod::Unsafe
149-
} else {
150-
h
151-
}
146+
if ptr.is_some_and(is_unsafe_node) { h | HlMod::Unsafe } else { h }
152147
}
153148
(T![-], PREFIX_EXPR) => {
154149
let prefix_expr =
@@ -224,11 +219,7 @@ fn punctuation(
224219
let is_unsafe = is_unsafe_macro
225220
|| operator_parent
226221
.and_then(|it| {
227-
if ast::ArgList::can_cast(it.kind()) {
228-
it.parent()
229-
} else {
230-
Some(it)
231-
}
222+
if ast::ArgList::can_cast(it.kind()) { it.parent() } else { Some(it) }
232223
})
233224
.and_then(|it| AstPtr::try_from_raw(SyntaxNodePtr::new(&it)))
234225
.is_some_and(is_unsafe_node);
@@ -297,7 +288,7 @@ fn highlight_name_ref(
297288
let name_class = match NameRefClass::classify(sema, &name_ref) {
298289
Some(name_kind) => name_kind,
299290
None if syntactic_name_ref_highlighting => {
300-
return highlight_name_ref_by_syntax(name_ref, sema, krate, is_unsafe_node)
291+
return highlight_name_ref_by_syntax(name_ref, sema, krate, is_unsafe_node);
301292
}
302293
// FIXME: This is required for helper attributes used by proc-macros, as those do not map down
303294
// to anything when used.
@@ -819,11 +810,7 @@ fn highlight_name_ref_by_syntax(
819810
let h = HlTag::Symbol(SymbolKind::Field);
820811
let is_unsafe = ast::Expr::cast(parent)
821812
.is_some_and(|it| is_unsafe_node(AstPtr::new(&it).wrap_left()));
822-
if is_unsafe {
823-
h | HlMod::Unsafe
824-
} else {
825-
h.into()
826-
}
813+
if is_unsafe { h | HlMod::Unsafe } else { h.into() }
827814
}
828815
PATH_SEGMENT => {
829816
let name_based_fallback = || {

crates/ra-salsa/src/derived/slot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ where
241241
Q::cycle_fallback(db, &cycle, key)
242242
} else {
243243
// we are not a participant in this cycle
244-
debug_assert!(!cycle
245-
.participant_keys()
246-
.any(|k| k == self.database_key_index()));
244+
debug_assert!(
245+
!cycle.participant_keys().any(|k| k == self.database_key_index())
246+
);
247247
cycle.throw()
248248
}
249249
}

crates/ra-salsa/src/derived_lru/slot.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ where
259259
Q::cycle_fallback(db, &cycle, key)
260260
} else {
261261
// we are not a participant in this cycle
262-
debug_assert!(!cycle
263-
.participant_keys()
264-
.any(|k| k == self.database_key_index()));
262+
debug_assert!(
263+
!cycle.participant_keys().any(|k| k == self.database_key_index())
264+
);
265265
cycle.throw()
266266
}
267267
}
@@ -378,10 +378,10 @@ where
378378
value: value.clone(),
379379
};
380380

381-
trace!(
382-
"{:?}: returning memoized value changed at {:?}",
383-
self, value.changed_at
384-
);
381+
trace!(
382+
"{:?}: returning memoized value changed at {:?}",
383+
self, value.changed_at
384+
);
385385

386386
ProbeState::UpToDate(value)
387387
} else {

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::{
3838
hack_recover_crate_name,
3939
line_index::LineEndings,
4040
lsp::{
41-
completion_item_hash,
41+
LspError, completion_item_hash,
4242
ext::{
4343
InternalTestingFetchConfigOption, InternalTestingFetchConfigParams,
4444
InternalTestingFetchConfigResponse,

crates/rust-analyzer/src/lsp/to_proto.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ use crate::{
3737
target_spec::{CargoTargetSpec, TargetSpec},
3838
};
3939

40+
use super::LspError;
41+
4042
pub(crate) fn position(line_index: &LineIndex, offset: TextSize) -> lsp_types::Position {
4143
let line_col = line_index.index.line_col(offset);
4244
match line_index.encoding {

crates/syntax/src/ast/prec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ impl Expr {
447447
}
448448

449449
fn is_ordered_before_parent_in_place_of(&self, parent: &Expr, place_of: &SyntaxNode) -> bool {
450-
use rowan::TextSize;
451450
use Expr::*;
451+
use rowan::TextSize;
452452

453453
let self_range = self.syntax().text_range();
454454
let place_of_range = place_of.text_range();

0 commit comments

Comments
 (0)