Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 41f6d88

Browse files
committed
make cargo test pass
1 parent a3aeec4 commit 41f6d88

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

clippy_lints/src/semicolon_block.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ fn semicolon_inside_block(
121121
let insert_span = tail.span.source_callsite().shrink_to_hi();
122122
let remove_span = semi_span.with_lo(block.span.hi());
123123

124-
if conf.semicolon_inside_block_if_multiline {
125-
if get_line(cx, remove_span) == get_line(cx, insert_span) {
126-
return;
127-
}
124+
if conf.semicolon_inside_block_if_multiline && get_line(cx, remove_span) == get_line(cx, insert_span) {
125+
return;
128126
}
129127

130128
span_lint_and_then(
@@ -143,16 +141,20 @@ fn semicolon_inside_block(
143141
);
144142
}
145143

146-
fn semicolon_outside_block(conf: &mut SemicolonBlock, cx: &LateContext<'_>, block: &Block<'_>, tail_stmt_expr: &Expr<'_>, semi_span: Span) {
144+
fn semicolon_outside_block(
145+
conf: &mut SemicolonBlock,
146+
cx: &LateContext<'_>,
147+
block: &Block<'_>,
148+
tail_stmt_expr: &Expr<'_>,
149+
semi_span: Span,
150+
) {
147151
let insert_span = block.span.with_lo(block.span.hi());
148152
// account for macro calls
149153
let semi_span = cx.sess().source_map().stmt_span(semi_span, block.span);
150154
let remove_span = semi_span.with_lo(tail_stmt_expr.span.source_callsite().hi());
151155

152-
if conf.semicolon_outside_block_if_singleline {
153-
if get_line(cx, remove_span) != get_line(cx, insert_span) {
154-
return;
155-
}
156+
if conf.semicolon_outside_block_if_singleline && get_line(cx, remove_span) != get_line(cx, insert_span) {
157+
return;
156158
}
157159

158160
span_lint_and_then(

clippy_lints/src/utils/conf.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ define_Conf! {
277277
/// `".."` can be used as part of the list to indicate, that the configured values should be appended to the
278278
/// default configuration of Clippy. By default, any configuration will replace the default value.
279279
(disallowed_names: Vec<String> = super::DEFAULT_DISALLOWED_NAMES.iter().map(ToString::to_string).collect()),
280+
/// Lint: SEMICOLON_INSIDE_BLOCK.
281+
///
282+
/// Whether to lint only if it's multiline.
283+
(semicolon_inside_block_if_multiline: bool = false),
284+
/// Lint: SEMICOLON_OUTSIDE_BLOCK.
285+
///
286+
/// Whether to lint only if it's singleline.
287+
(semicolon_outside_block_if_singleline: bool = false),
280288
/// Lint: DOC_MARKDOWN.
281289
///
282290
/// The list of words this lint should not consider as identifiers needing ticks. The value
@@ -463,14 +471,6 @@ define_Conf! {
463471
///
464472
/// The maximum byte size a `Future` can have, before it triggers the `clippy::large_futures` lint
465473
(future_size_threshold: u64 = 16 * 1024),
466-
/// Lint: SEMICOLON_INSIDE_BLOCK.
467-
///
468-
/// Whether to lint only if it's multiline.
469-
(semicolon_inside_block_if_multiline: bool = false),
470-
/// Lint: SEMICOLON_OUTSIDE_BLOCK.
471-
///
472-
/// Whether to lint only if it's singleline.
473-
(semicolon_outside_block_if_singleline: bool = false),
474474
}
475475

476476
/// Search for the configuration file.

0 commit comments

Comments
 (0)