Skip to content

Commit 6ddfaba

Browse files
committed
Fix adjacent code
1 parent 0a91eaa commit 6ddfaba

29 files changed

+52
-50
lines changed

clippy.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
avoid-breaking-exported-api = false
22

3+
initializer-suggestions = "machine-applicable"
4+
35
[[disallowed-methods]]
46
path = "rustc_lint::context::LintContext::lint"
57
reason = "this function does not add a link to our documentation, please use the `clippy_utils::diagnostics::span_lint*` functions instead"

clippy_dev/src/fmt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ fn fmt_conf(check: bool) -> Result<(), Error> {
179179
#[expect(clippy::drain_collect)]
180180
fields.push(ClippyConf {
181181
name,
182-
lints: lints.drain(..).collect(),
183182
attrs: &conf[attrs_start..attrs_end],
183+
lints: lints.drain(..).collect(),
184184
field: conf[field_start..i].trim_end(),
185185
});
186186
attrs_start = i;
@@ -191,8 +191,8 @@ fn fmt_conf(check: bool) -> Result<(), Error> {
191191
#[expect(clippy::drain_collect)]
192192
fields.push(ClippyConf {
193193
name,
194-
lints: lints.drain(..).collect(),
195194
attrs: &conf[attrs_start..attrs_end],
195+
lints: lints.drain(..).collect(),
196196
field: conf[field_start..i].trim_end(),
197197
});
198198
attrs_start = i;
@@ -220,8 +220,8 @@ fn fmt_conf(check: bool) -> Result<(), Error> {
220220
}
221221
fields.push(ClippyConf {
222222
name,
223-
lints,
224223
attrs: &conf[attrs_start..attrs_end],
224+
lints,
225225
field: conf[field_start..].trim_end(),
226226
});
227227

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
428428

429429
// Makes a note of the current item for comparison with the next.
430430
cur_t = Some(CurItem {
431-
order: module_level_order,
432431
item,
432+
order: module_level_order,
433433
name: get_item_name(item),
434434
});
435435
}

clippy_lints/src/doc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ fn check_attrs(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs: &[
770770
parser.into_offset_iter(),
771771
&doc,
772772
Fragments {
773-
fragments: &fragments,
774773
doc: &doc,
774+
fragments: &fragments,
775775
},
776776
))
777777
}

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,12 +678,12 @@ fn find_insert_calls<'tcx>(
678678
map: contains_expr.map,
679679
key: contains_expr.key,
680680
ctxt: expr.span.ctxt(),
681-
edits: Vec::new(),
682-
is_map_used: false,
683681
allow_insert_closure: true,
684682
can_use_entry: true,
685683
in_tail_pos: true,
686684
is_single_insert: true,
685+
is_map_used: false,
686+
edits: Vec::new(),
687687
loops: Vec::new(),
688688
locals: HirIdSet::default(),
689689
};

clippy_lints/src/implied_bounds_in_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
243243
&& !predicates.is_empty()
244244
{
245245
Some(ImplTraitBound {
246+
span: bound.span(),
246247
predicates,
248+
trait_def_id,
247249
args: path.args.map_or([].as_slice(), |p| p.args),
248250
constraints: path.args.map_or([].as_slice(), |p| p.constraints),
249-
trait_def_id,
250-
span: bound.span(),
251251
})
252252
} else {
253253
None

clippy_lints/src/loops/infinite_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ pub(super) fn check<'tcx>(
3838
cx,
3939
label,
4040
inner_labels: label.into_iter().collect(),
41-
is_finite: false,
4241
loop_depth: 0,
42+
is_finite: false,
4343
};
4444
loop_visitor.visit_block(loop_block);
4545

clippy_lints/src/macro_metavars_in_unsafe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ impl<'tcx> LateLintPass<'tcx> for ExprMetavarsInUnsafe {
220220
// `check_stmt_post` on `(Late)LintPass`, which we'd need to detect when we're leaving a macro span
221221

222222
let mut vis = BodyVisitor {
223+
macro_unsafe_blocks: Vec::new(),
223224
#[expect(clippy::bool_to_int_with_if)] // obfuscates the meaning
224225
expn_depth: if body.value.span.from_expansion() { 1 } else { 0 },
225-
macro_unsafe_blocks: Vec::new(),
226-
lint: self,
227-
cx
226+
cx,
227+
lint: self
228228
};
229229
vis.visit_body(body);
230230
}

clippy_lints/src/methods/needless_collect.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,14 @@ fn detect_iter_and_into_iters<'tcx: 'a, 'a>(
469469
captured_ids: HirIdSet,
470470
) -> Option<Vec<IterFunction>> {
471471
let mut visitor = IterFunctionVisitor {
472-
uses: Vec::new(),
473-
target: id,
474-
seen_other: false,
475-
cx,
476-
current_mutably_captured_ids: HirIdSet::default(),
477472
illegal_mutable_capture_ids: captured_ids,
473+
current_mutably_captured_ids: HirIdSet::default(),
474+
cx,
475+
uses: Vec::new(),
478476
hir_id_uses_map: FxHashMap::default(),
479477
current_statement_hir_id: None,
478+
seen_other: false,
479+
target: id,
480480
};
481481
visitor.visit_block(block);
482482
if visitor.seen_other {

clippy_lints/src/methods/str_splitn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ fn parse_iter_usage<'tcx>(
293293
{
294294
Some(IterUsage {
295295
kind: IterUsageKind::NextTuple,
296-
span: e.span,
297296
unwrap_kind: None,
297+
span: e.span,
298298
})
299299
} else {
300300
None

0 commit comments

Comments
 (0)