Skip to content

Commit 69d78ce

Browse files
committed
removing unsafe from test fn's && renaming shrink to sugg_span
1 parent 4950272 commit 69d78ce

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

clippy_lints/src/methods/or_fun_call.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub(super) fn check<'tcx>(
5656
then {
5757
let mut applicability = Applicability::MachineApplicable;
5858
let hint = "unwrap_or_default()";
59-
let mut shrink = span;
59+
let mut sugg_span = span;
6060

6161
let mut sugg: String = format!(
6262
"{}.{}",
@@ -65,14 +65,14 @@ pub(super) fn check<'tcx>(
6565
);
6666

6767
if sugg.lines().count() > MAX_SUGGESTION_HIGHLIGHT_LINES {
68-
shrink = method_span.with_hi(span.hi());
68+
sugg_span = method_span.with_hi(span.hi());
6969
sugg = hint.to_string();
7070
}
7171

7272
span_lint_and_sugg(
7373
cx,
7474
OR_FUN_CALL,
75-
shrink,
75+
sugg_span,
7676
&format!("use of `{}` followed by a call to `{}`", name, path),
7777
"try this",
7878
sugg,

tests/ui/or_fun_call.fixed

+4-4
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mod issue6675 {
177177
}
178178

179179
mod issue8239 {
180-
unsafe fn more_than_max_suggestion_highest_lines_0() {
180+
fn more_than_max_suggestion_highest_lines_0() {
181181
let frames = Vec::new();
182182
frames
183183
.iter()
@@ -189,7 +189,7 @@ mod issue8239 {
189189
.unwrap_or_default();
190190
}
191191

192-
unsafe fn more_to_max_suggestion_highest_lines_1() {
192+
fn more_to_max_suggestion_highest_lines_1() {
193193
let frames = Vec::new();
194194
let iter = frames.iter();
195195
iter.map(|f: &String| f.to_lowercase())
@@ -202,7 +202,7 @@ mod issue8239 {
202202
.unwrap_or_default();
203203
}
204204

205-
unsafe fn equal_to_max_suggestion_highest_lines() {
205+
fn equal_to_max_suggestion_highest_lines() {
206206
let frames = Vec::new();
207207
let iter = frames.iter();
208208
iter.map(|f: &String| f.to_lowercase())
@@ -213,7 +213,7 @@ mod issue8239 {
213213
}).unwrap_or_default();
214214
}
215215

216-
unsafe fn less_than_max_suggestion_highest_lines() {
216+
fn less_than_max_suggestion_highest_lines() {
217217
let frames = Vec::new();
218218
let iter = frames.iter();
219219
let map = iter.map(|f: &String| f.to_lowercase());

tests/ui/or_fun_call.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ mod issue6675 {
177177
}
178178

179179
mod issue8239 {
180-
unsafe fn more_than_max_suggestion_highest_lines_0() {
180+
fn more_than_max_suggestion_highest_lines_0() {
181181
let frames = Vec::new();
182182
frames
183183
.iter()
@@ -189,7 +189,7 @@ mod issue8239 {
189189
.unwrap_or(String::new());
190190
}
191191

192-
unsafe fn more_to_max_suggestion_highest_lines_1() {
192+
fn more_to_max_suggestion_highest_lines_1() {
193193
let frames = Vec::new();
194194
let iter = frames.iter();
195195
iter.map(|f: &String| f.to_lowercase())
@@ -202,7 +202,7 @@ mod issue8239 {
202202
.unwrap_or(String::new());
203203
}
204204

205-
unsafe fn equal_to_max_suggestion_highest_lines() {
205+
fn equal_to_max_suggestion_highest_lines() {
206206
let frames = Vec::new();
207207
let iter = frames.iter();
208208
iter.map(|f: &String| f.to_lowercase())
@@ -214,7 +214,7 @@ mod issue8239 {
214214
.unwrap_or(String::new());
215215
}
216216

217-
unsafe fn less_than_max_suggestion_highest_lines() {
217+
fn less_than_max_suggestion_highest_lines() {
218218
let frames = Vec::new();
219219
let iter = frames.iter();
220220
let map = iter.map(|f: &String| f.to_lowercase());

0 commit comments

Comments
 (0)