make cargo test pass
This commit is contained in:
parent
a3aeec4f75
commit
41f6d88be5
@ -121,11 +121,9 @@ fn semicolon_inside_block(
|
|||||||
let insert_span = tail.span.source_callsite().shrink_to_hi();
|
let insert_span = tail.span.source_callsite().shrink_to_hi();
|
||||||
let remove_span = semi_span.with_lo(block.span.hi());
|
let remove_span = semi_span.with_lo(block.span.hi());
|
||||||
|
|
||||||
if conf.semicolon_inside_block_if_multiline {
|
if conf.semicolon_inside_block_if_multiline && get_line(cx, remove_span) == get_line(cx, insert_span) {
|
||||||
if get_line(cx, remove_span) == get_line(cx, insert_span) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
span_lint_and_then(
|
span_lint_and_then(
|
||||||
cx,
|
cx,
|
||||||
@ -143,17 +141,21 @@ fn semicolon_inside_block(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn semicolon_outside_block(conf: &mut SemicolonBlock, cx: &LateContext<'_>, block: &Block<'_>, tail_stmt_expr: &Expr<'_>, semi_span: Span) {
|
fn semicolon_outside_block(
|
||||||
|
conf: &mut SemicolonBlock,
|
||||||
|
cx: &LateContext<'_>,
|
||||||
|
block: &Block<'_>,
|
||||||
|
tail_stmt_expr: &Expr<'_>,
|
||||||
|
semi_span: Span,
|
||||||
|
) {
|
||||||
let insert_span = block.span.with_lo(block.span.hi());
|
let insert_span = block.span.with_lo(block.span.hi());
|
||||||
// account for macro calls
|
// account for macro calls
|
||||||
let semi_span = cx.sess().source_map().stmt_span(semi_span, block.span);
|
let semi_span = cx.sess().source_map().stmt_span(semi_span, block.span);
|
||||||
let remove_span = semi_span.with_lo(tail_stmt_expr.span.source_callsite().hi());
|
let remove_span = semi_span.with_lo(tail_stmt_expr.span.source_callsite().hi());
|
||||||
|
|
||||||
if conf.semicolon_outside_block_if_singleline {
|
if conf.semicolon_outside_block_if_singleline && get_line(cx, remove_span) != get_line(cx, insert_span) {
|
||||||
if get_line(cx, remove_span) != get_line(cx, insert_span) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
span_lint_and_then(
|
span_lint_and_then(
|
||||||
cx,
|
cx,
|
||||||
|
@ -277,6 +277,14 @@ pub(crate) fn get_configuration_metadata() -> Vec<ClippyConfiguration> {
|
|||||||
/// `".."` can be used as part of the list to indicate, that the configured values should be appended to the
|
/// `".."` can be used as part of the list to indicate, that the configured values should be appended to the
|
||||||
/// default configuration of Clippy. By default, any configuration will replace the default value.
|
/// default configuration of Clippy. By default, any configuration will replace the default value.
|
||||||
(disallowed_names: Vec<String> = super::DEFAULT_DISALLOWED_NAMES.iter().map(ToString::to_string).collect()),
|
(disallowed_names: Vec<String> = super::DEFAULT_DISALLOWED_NAMES.iter().map(ToString::to_string).collect()),
|
||||||
|
/// Lint: SEMICOLON_INSIDE_BLOCK.
|
||||||
|
///
|
||||||
|
/// Whether to lint only if it's multiline.
|
||||||
|
(semicolon_inside_block_if_multiline: bool = false),
|
||||||
|
/// Lint: SEMICOLON_OUTSIDE_BLOCK.
|
||||||
|
///
|
||||||
|
/// Whether to lint only if it's singleline.
|
||||||
|
(semicolon_outside_block_if_singleline: bool = false),
|
||||||
/// Lint: DOC_MARKDOWN.
|
/// Lint: DOC_MARKDOWN.
|
||||||
///
|
///
|
||||||
/// The list of words this lint should not consider as identifiers needing ticks. The value
|
/// The list of words this lint should not consider as identifiers needing ticks. The value
|
||||||
@ -463,14 +471,6 @@ pub(crate) fn get_configuration_metadata() -> Vec<ClippyConfiguration> {
|
|||||||
///
|
///
|
||||||
/// The maximum byte size a `Future` can have, before it triggers the `clippy::large_futures` lint
|
/// The maximum byte size a `Future` can have, before it triggers the `clippy::large_futures` lint
|
||||||
(future_size_threshold: u64 = 16 * 1024),
|
(future_size_threshold: u64 = 16 * 1024),
|
||||||
/// Lint: SEMICOLON_INSIDE_BLOCK.
|
|
||||||
///
|
|
||||||
/// Whether to lint only if it's multiline.
|
|
||||||
(semicolon_inside_block_if_multiline: bool = false),
|
|
||||||
/// Lint: SEMICOLON_OUTSIDE_BLOCK.
|
|
||||||
///
|
|
||||||
/// Whether to lint only if it's singleline.
|
|
||||||
(semicolon_outside_block_if_singleline: bool = false),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Search for the configuration file.
|
/// Search for the configuration file.
|
||||||
|
Loading…
Reference in New Issue
Block a user