about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarek Downar <marek.downar@evomedia.pl>2022-01-17 12:34:03 +0100
committerMarek Downar <marek.downar@evomedia.pl>2022-01-17 12:34:03 +0100
commit69d78ceeba0627d650d6058a456fdfb2df0eaa7f (patch)
tree59d5ee11d3bc918d818c14409696e89edc1e114b
parent49502727e7db97055d04c7f06e04b73b05fdb7e2 (diff)
downloadrust-69d78ceeba0627d650d6058a456fdfb2df0eaa7f.tar.gz
rust-69d78ceeba0627d650d6058a456fdfb2df0eaa7f.zip
removing unsafe from test fn's && renaming shrink to sugg_span
-rw-r--r--clippy_lints/src/methods/or_fun_call.rs6
-rw-r--r--tests/ui/or_fun_call.fixed8
-rw-r--r--tests/ui/or_fun_call.rs8
3 files changed, 11 insertions, 11 deletions
diff --git a/clippy_lints/src/methods/or_fun_call.rs b/clippy_lints/src/methods/or_fun_call.rs
index c35a2e57a66..448dc4e6147 100644
--- a/clippy_lints/src/methods/or_fun_call.rs
+++ b/clippy_lints/src/methods/or_fun_call.rs
@@ -56,7 +56,7 @@ pub(super) fn check<'tcx>(
             then {
                 let mut applicability = Applicability::MachineApplicable;
                 let hint = "unwrap_or_default()";
-                let mut shrink = span;
+                let mut sugg_span = span;
 
                 let mut sugg: String = format!(
                     "{}.{}",
@@ -65,14 +65,14 @@ pub(super) fn check<'tcx>(
                 );
 
                 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();
                 }
 
                 span_lint_and_sugg(
                     cx,
                     OR_FUN_CALL,
-                    shrink,
+                    sugg_span,
                     &format!("use of `{}` followed by a call to `{}`", name, path),
                     "try this",
                     sugg,
diff --git a/tests/ui/or_fun_call.fixed b/tests/ui/or_fun_call.fixed
index fe8f5c9fc62..3208048e0d5 100644
--- a/tests/ui/or_fun_call.fixed
+++ b/tests/ui/or_fun_call.fixed
@@ -177,7 +177,7 @@ mod issue6675 {
 }
 
 mod issue8239 {
-    unsafe fn more_than_max_suggestion_highest_lines_0() {
+    fn more_than_max_suggestion_highest_lines_0() {
         let frames = Vec::new();
         frames
             .iter()
@@ -189,7 +189,7 @@ mod issue8239 {
             .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 iter = frames.iter();
         iter.map(|f: &String| f.to_lowercase())
@@ -202,7 +202,7 @@ mod issue8239 {
             .unwrap_or_default();
     }
 
-    unsafe fn equal_to_max_suggestion_highest_lines() {
+    fn equal_to_max_suggestion_highest_lines() {
         let frames = Vec::new();
         let iter = frames.iter();
         iter.map(|f: &String| f.to_lowercase())
@@ -213,7 +213,7 @@ mod issue8239 {
             }).unwrap_or_default();
     }
 
-    unsafe fn less_than_max_suggestion_highest_lines() {
+    fn less_than_max_suggestion_highest_lines() {
         let frames = Vec::new();
         let iter = frames.iter();
         let map = iter.map(|f: &String| f.to_lowercase());
diff --git a/tests/ui/or_fun_call.rs b/tests/ui/or_fun_call.rs
index a702d9dadd4..57ab5f03ee2 100644
--- a/tests/ui/or_fun_call.rs
+++ b/tests/ui/or_fun_call.rs
@@ -177,7 +177,7 @@ mod issue6675 {
 }
 
 mod issue8239 {
-    unsafe fn more_than_max_suggestion_highest_lines_0() {
+    fn more_than_max_suggestion_highest_lines_0() {
         let frames = Vec::new();
         frames
             .iter()
@@ -189,7 +189,7 @@ mod issue8239 {
             .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 iter = frames.iter();
         iter.map(|f: &String| f.to_lowercase())
@@ -202,7 +202,7 @@ mod issue8239 {
             .unwrap_or(String::new());
     }
 
-    unsafe fn equal_to_max_suggestion_highest_lines() {
+    fn equal_to_max_suggestion_highest_lines() {
         let frames = Vec::new();
         let iter = frames.iter();
         iter.map(|f: &String| f.to_lowercase())
@@ -214,7 +214,7 @@ mod issue8239 {
             .unwrap_or(String::new());
     }
 
-    unsafe fn less_than_max_suggestion_highest_lines() {
+    fn less_than_max_suggestion_highest_lines() {
         let frames = Vec::new();
         let iter = frames.iter();
         let map = iter.map(|f: &String| f.to_lowercase());