removing unsafe from test fn's && renaming shrink to sugg_span
This commit is contained in:
parent
49502727e7
commit
69d78ceeba
@ -56,7 +56,7 @@ pub(super) fn check<'tcx>(
|
|||||||
then {
|
then {
|
||||||
let mut applicability = Applicability::MachineApplicable;
|
let mut applicability = Applicability::MachineApplicable;
|
||||||
let hint = "unwrap_or_default()";
|
let hint = "unwrap_or_default()";
|
||||||
let mut shrink = span;
|
let mut sugg_span = span;
|
||||||
|
|
||||||
let mut sugg: String = format!(
|
let mut sugg: String = format!(
|
||||||
"{}.{}",
|
"{}.{}",
|
||||||
@ -65,14 +65,14 @@ pub(super) fn check<'tcx>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if sugg.lines().count() > MAX_SUGGESTION_HIGHLIGHT_LINES {
|
if sugg.lines().count() > MAX_SUGGESTION_HIGHLIGHT_LINES {
|
||||||
shrink = method_span.with_hi(span.hi());
|
sugg_span = method_span.with_hi(span.hi());
|
||||||
sugg = hint.to_string();
|
sugg = hint.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
OR_FUN_CALL,
|
OR_FUN_CALL,
|
||||||
shrink,
|
sugg_span,
|
||||||
&format!("use of `{}` followed by a call to `{}`", name, path),
|
&format!("use of `{}` followed by a call to `{}`", name, path),
|
||||||
"try this",
|
"try this",
|
||||||
sugg,
|
sugg,
|
||||||
|
@ -177,7 +177,7 @@ mod issue6675 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod issue8239 {
|
mod issue8239 {
|
||||||
unsafe fn more_than_max_suggestion_highest_lines_0() {
|
fn more_than_max_suggestion_highest_lines_0() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
frames
|
frames
|
||||||
.iter()
|
.iter()
|
||||||
@ -189,7 +189,7 @@ mod issue8239 {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn more_to_max_suggestion_highest_lines_1() {
|
fn more_to_max_suggestion_highest_lines_1() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
iter.map(|f: &String| f.to_lowercase())
|
iter.map(|f: &String| f.to_lowercase())
|
||||||
@ -202,7 +202,7 @@ mod issue8239 {
|
|||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn equal_to_max_suggestion_highest_lines() {
|
fn equal_to_max_suggestion_highest_lines() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
iter.map(|f: &String| f.to_lowercase())
|
iter.map(|f: &String| f.to_lowercase())
|
||||||
@ -213,7 +213,7 @@ mod issue8239 {
|
|||||||
}).unwrap_or_default();
|
}).unwrap_or_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn less_than_max_suggestion_highest_lines() {
|
fn less_than_max_suggestion_highest_lines() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
let map = iter.map(|f: &String| f.to_lowercase());
|
let map = iter.map(|f: &String| f.to_lowercase());
|
||||||
|
@ -177,7 +177,7 @@ mod issue6675 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod issue8239 {
|
mod issue8239 {
|
||||||
unsafe fn more_than_max_suggestion_highest_lines_0() {
|
fn more_than_max_suggestion_highest_lines_0() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
frames
|
frames
|
||||||
.iter()
|
.iter()
|
||||||
@ -189,7 +189,7 @@ mod issue8239 {
|
|||||||
.unwrap_or(String::new());
|
.unwrap_or(String::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn more_to_max_suggestion_highest_lines_1() {
|
fn more_to_max_suggestion_highest_lines_1() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
iter.map(|f: &String| f.to_lowercase())
|
iter.map(|f: &String| f.to_lowercase())
|
||||||
@ -202,7 +202,7 @@ mod issue8239 {
|
|||||||
.unwrap_or(String::new());
|
.unwrap_or(String::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn equal_to_max_suggestion_highest_lines() {
|
fn equal_to_max_suggestion_highest_lines() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
iter.map(|f: &String| f.to_lowercase())
|
iter.map(|f: &String| f.to_lowercase())
|
||||||
@ -214,7 +214,7 @@ mod issue8239 {
|
|||||||
.unwrap_or(String::new());
|
.unwrap_or(String::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn less_than_max_suggestion_highest_lines() {
|
fn less_than_max_suggestion_highest_lines() {
|
||||||
let frames = Vec::new();
|
let frames = Vec::new();
|
||||||
let iter = frames.iter();
|
let iter = frames.iter();
|
||||||
let map = iter.map(|f: &String| f.to_lowercase());
|
let map = iter.map(|f: &String| f.to_lowercase());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user