Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Revert revert multiple suggestions fix #195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
})
.filter_map(collect_span)
.collect();
if replacements.len() == 1 {
if replacements.len() >= 1 {
Some(Solution {
message: child.message.clone(),
replacements,
Expand Down
5 changes: 0 additions & 5 deletions tests/edge-cases/skip-multi-option-lints.fixed.rs

This file was deleted.

100 changes: 0 additions & 100 deletions tests/edge-cases/skip-multi-option-lints.json

This file was deleted.

5 changes: 0 additions & 5 deletions tests/edge-cases/skip-multi-option-lints.rs

This file was deleted.

1 change: 0 additions & 1 deletion tests/edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ macro_rules! expect_empty_json_test {
};
}

expect_empty_json_test! {multiple_fix_options_yield_no_suggestions, "skip-multi-option-lints.json"}
expect_empty_json_test! {out_of_bounds_test, "out_of_bounds.recorded.json"}
expect_empty_json_test! {utf8_identifiers_test, "utf8_idents.recorded.json"}
expect_empty_json_test! {empty, "empty.json"}
Expand Down
5 changes: 5 additions & 0 deletions tests/everything/multiple-solutions.fixed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use std::collections::{HashSet};

fn main() {
let _: HashSet<()>;
}
114 changes: 114 additions & 0 deletions tests/everything/multiple-solutions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"message": "unused imports: `HashMap`, `VecDeque`",
"code": {
"code": "unused_imports",
"explanation": null
},
"level": "warning",
"spans": [
{
"file_name": "src/main.rs",
"byte_start": 23,
"byte_end": 30,
"line_start": 1,
"line_end": 1,
"column_start": 24,
"column_end": 31,
"is_primary": true,
"text": [
{
"text": "use std::collections::{HashMap, HashSet, VecDeque};",
"highlight_start": 24,
"highlight_end": 31
}
],
"label": null,
"suggested_replacement": null,
"suggestion_applicability": null,
"expansion": null
},
{
"file_name": "src/main.rs",
"byte_start": 41,
"byte_end": 49,
"line_start": 1,
"line_end": 1,
"column_start": 42,
"column_end": 50,
"is_primary": true,
"text": [
{
"text": "use std::collections::{HashMap, HashSet, VecDeque};",
"highlight_start": 42,
"highlight_end": 50
}
],
"label": null,
"suggested_replacement": null,
"suggestion_applicability": null,
"expansion": null
}
],
"children": [
{
"message": "#[warn(unused_imports)] on by default",
"code": null,
"level": "note",
"spans": [],
"children": [],
"rendered": null
},
{
"message": "remove the unused imports",
"code": null,
"level": "help",
"spans": [
{
"file_name": "src/main.rs",
"byte_start": 23,
"byte_end": 32,
"line_start": 1,
"line_end": 1,
"column_start": 24,
"column_end": 33,
"is_primary": true,
"text": [
{
"text": "use std::collections::{HashMap, HashSet, VecDeque};",
"highlight_start": 24,
"highlight_end": 33
}
],
"label": null,
"suggested_replacement": "",
"suggestion_applicability": "MachineApplicable",
"expansion": null
},
{
"file_name": "src/main.rs",
"byte_start": 39,
"byte_end": 49,
"line_start": 1,
"line_end": 1,
"column_start": 40,
"column_end": 50,
"is_primary": true,
"text": [
{
"text": "use std::collections::{HashMap, HashSet, VecDeque};",
"highlight_start": 40,
"highlight_end": 50
}
],
"label": null,
"suggested_replacement": "",
"suggestion_applicability": "MachineApplicable",
"expansion": null
}
],
"children": [],
"rendered": null
}
],
"rendered": "warning: unused imports: `HashMap`, `VecDeque`\n --> src/main.rs:1:24\n |\n1 | use std::collections::{HashMap, HashSet, VecDeque};\n | ^^^^^^^ ^^^^^^^^\n |\n = note: #[warn(unused_imports)] on by default\nhelp: remove the unused imports\n |\n1 | use std::collections::{HashSet};\n | -- --\n\n"
}
5 changes: 5 additions & 0 deletions tests/everything/multiple-solutions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use std::collections::{HashMap, HashSet, VecDeque};

fn main() {
let _: HashSet<()>;
}