mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
b7929cafe1
Before, when you had a block comment between an attribute and the following item like this: ```rust \#[crate_type = "lib"] /* */ pub struct Rust; ``` It would cause a false positive on the lint, because there is an empty line inside the block comment. This makes sure that basic block comments are detected and removed from the snippet that was created before.
20 lines
676 B
Rust
20 lines
676 B
Rust
extern crate clippy_lints;
|
|
use clippy_lints::utils::without_block_comments;
|
|
|
|
#[test]
|
|
fn test_lines_without_block_comments() {
|
|
let result = without_block_comments(vec!["/*", "", "*/"]);
|
|
println!("result: {:?}", result);
|
|
assert!(result.is_empty());
|
|
|
|
let result = without_block_comments(
|
|
vec!["", "/*", "", "*/", "#[crate_type = \"lib\"]", "/*", "", "*/", ""]
|
|
);
|
|
assert_eq!(result, vec!["", "#[crate_type = \"lib\"]", ""]);
|
|
|
|
let result = without_block_comments(vec!["/* rust", "", "*/"]);
|
|
assert!(result.is_empty());
|
|
|
|
let result = without_block_comments(vec!["foo", "bar", "baz"]);
|
|
assert_eq!(result, vec!["foo", "bar", "baz"]);
|
|
}
|