Skip to content

Commit d9eaff3

Browse files
cargo fmt
1 parent 887e059 commit d9eaff3

File tree

17 files changed

+41
-52
lines changed

17 files changed

+41
-52
lines changed

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

+1-2
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

+1-1
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

+2-2
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

+1-2
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use hir_expand::{
3131
name::AsName,
3232
};
3333
use hir_ty::diagnostics::unsafe_operations_for_body;
34-
use intern::{sym, Symbol};
34+
use intern::{Symbol, sym};
3535
use itertools::Itertools;
3636
use rustc_hash::{FxHashMap, FxHashSet};
3737
use smallvec::{SmallVec, smallvec};
@@ -46,16 +46,16 @@ use syntax::{
4646
use triomphe::Arc;
4747

4848
use crate::{
49-
db::HirDatabase,
50-
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
51-
source_analyzer::{name_hygiene, resolve_hir_path, SourceAnalyzer},
5249
Adjust, Adjustment, Adt, AutoBorrow, BindingMode, BuiltinAttr, Callable, Const, ConstParam,
5350
Crate, DefWithBody, DeriveHelper, Enum, Field, Function, GenericSubstitution, HasSource,
5451
HirFileId, Impl, InFile, InlineAsmOperand, ItemInNs, Label, LifetimeParam, Local, Macro,
5552
Module, ModuleDef, Name, OverloadedDeref, Path, ScopeDef, Static, Struct, ToolModule, Trait,
5653
TraitAlias, TupleField, Type, TypeAlias, TypeParam, Union, Variant, VariantDef,
5754
db::HirDatabase,
55+
db::HirDatabase,
5856
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
57+
semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
58+
source_analyzer::{SourceAnalyzer, name_hygiene, resolve_hir_path},
5959
source_analyzer::{SourceAnalyzer, name_hygiene, resolve_hir_path},
6060
};
6161

crates/hir/src/source_analyzer.rs

+2-2
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

-1
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

+1-2
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use ide_db::{
55
search::{FileReference, FileReferenceNode, UsageSearchResult},
66
};
77
use syntax::{
8-
ast::{self, syntax_factory::SyntaxFactory, AstNode, AstToken, HasName},
98
SyntaxElement, TextRange,
109
ast::{self, AstNode, AstToken, HasName},
10+
ast::{self, AstNode, AstToken, HasName, syntax_factory::SyntaxFactory},
1111
};
1212

1313
use crate::{

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

+2-2
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

+4-1
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

+8-20
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ 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+
defs::{Definition, IdentClass, NameClass, NameRefClass},
11+
syntax_helpers::node_ext::walk_pat,
1212
};
1313
use span::Edition;
1414
use stdx::hash_once;
1515
use syntax::{
16-
ast, match_ast, AstNode, AstPtr, AstToken, NodeOrToken,
16+
AstNode, AstPtr, AstToken, NodeOrToken,
1717
SyntaxKind::{self, *},
18-
SyntaxNode, SyntaxNodePtr, SyntaxToken, T,
18+
SyntaxNode, SyntaxNodePtr, SyntaxToken, T, ast, match_ast,
1919
};
2020

2121
use crate::{
@@ -144,11 +144,7 @@ fn punctuation(
144144
let ptr = operator_parent
145145
.as_ref()
146146
.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-
}
147+
if ptr.is_some_and(is_unsafe_node) { h | HlMod::Unsafe } else { h }
152148
}
153149
(T![-], PREFIX_EXPR) => {
154150
let prefix_expr =
@@ -224,11 +220,7 @@ fn punctuation(
224220
let is_unsafe = is_unsafe_macro
225221
|| operator_parent
226222
.and_then(|it| {
227-
if ast::ArgList::can_cast(it.kind()) {
228-
it.parent()
229-
} else {
230-
Some(it)
231-
}
223+
if ast::ArgList::can_cast(it.kind()) { it.parent() } else { Some(it) }
232224
})
233225
.and_then(|it| AstPtr::try_from_raw(SyntaxNodePtr::new(&it)))
234226
.is_some_and(is_unsafe_node);
@@ -297,7 +289,7 @@ fn highlight_name_ref(
297289
let name_class = match NameRefClass::classify(sema, &name_ref) {
298290
Some(name_kind) => name_kind,
299291
None if syntactic_name_ref_highlighting => {
300-
return highlight_name_ref_by_syntax(name_ref, sema, krate, is_unsafe_node)
292+
return highlight_name_ref_by_syntax(name_ref, sema, krate, is_unsafe_node);
301293
}
302294
// FIXME: This is required for helper attributes used by proc-macros, as those do not map down
303295
// to anything when used.
@@ -819,11 +811,7 @@ fn highlight_name_ref_by_syntax(
819811
let h = HlTag::Symbol(SymbolKind::Field);
820812
let is_unsafe = ast::Expr::cast(parent)
821813
.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-
}
814+
if is_unsafe { h | HlMod::Unsafe } else { h.into() }
827815
}
828816
PATH_SEGMENT => {
829817
let name_based_fallback = || {

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

+3-3
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

+7-7
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

+1-1
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

+2
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

+1-1
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)