about summary refs log tree commit diff
diff options
context:
space:
mode:
authordaxpedda <daxpedda@users.noreply.github.com>2018-12-05 10:54:21 +0100
committerdaxpedda <daxpedda@users.noreply.github.com>2018-12-05 10:54:21 +0100
commit978f8c65ee44b43243a83a047be6cdacb6df1320 (patch)
tree68fd6202d37f9948244a64a000b073a32bdab9aa
parentd5d669228867259277ce2724bb2fa510d16f0b47 (diff)
downloadrust-978f8c65ee44b43243a83a047be6cdacb6df1320.tar.gz
rust-978f8c65ee44b43243a83a047be6cdacb6df1320.zip
Renamed `forced_return` to `missing_returns`.
Better clarification in the docs.
Ran `update_lints`.
-rw-r--r--CHANGELOG.md1
-rw-r--r--clippy_lints/src/lib.rs6
-rw-r--r--clippy_lints/src/missing_returns.rs (renamed from clippy_lints/src/forced_return.rs)18
-rw-r--r--tests/ui/missing_returns.rs (renamed from tests/ui/forced_return.rs)2
-rw-r--r--tests/ui/missing_returns.stderr (renamed from tests/ui/forced_return.stderr)16
5 files changed, 22 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 320a3511e5c..ed5057daf29 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -756,6 +756,7 @@ All notable changes to this project will be documented in this file.
 [`misrefactored_assign_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#misrefactored_assign_op
 [`missing_docs_in_private_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items
 [`missing_inline_in_public_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_inline_in_public_items
+[`missing_returns`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_returns
 [`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes
 [`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals
 [`module_inception`]: https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 729e3a20c2c..87dbe8708b9 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -152,6 +152,7 @@ pub mod misc;
 pub mod misc_early;
 pub mod missing_doc;
 pub mod missing_inline;
+pub mod missing_returns;
 pub mod multiple_crate_versions;
 pub mod mut_mut;
 pub mod mut_reference;
@@ -185,7 +186,6 @@ pub mod reference;
 pub mod regex;
 pub mod replace_consts;
 pub mod returns;
-pub mod forced_return;
 pub mod serde_api;
 pub mod shadow;
 pub mod slow_vector_initialization;
@@ -372,7 +372,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
     reg.register_late_lint_pass(box unicode::Unicode);
     reg.register_late_lint_pass(box strings::StringAdd);
     reg.register_early_lint_pass(box returns::ReturnPass);
-    reg.register_late_lint_pass(box forced_return::ForcedReturnPass);
+    reg.register_late_lint_pass(box missing_returns::MissingReturnsPass);
     reg.register_late_lint_pass(box methods::Pass);
     reg.register_late_lint_pass(box map_clone::Pass);
     reg.register_late_lint_pass(box shadow::Pass);
@@ -498,13 +498,13 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         misc::FLOAT_CMP_CONST,
         missing_doc::MISSING_DOCS_IN_PRIVATE_ITEMS,
         missing_inline::MISSING_INLINE_IN_PUBLIC_ITEMS,
+        missing_returns::MISSING_RETURNS,
         panic_unimplemented::UNIMPLEMENTED,
         shadow::SHADOW_REUSE,
         shadow::SHADOW_SAME,
         strings::STRING_ADD,
         write::PRINT_STDOUT,
         write::USE_DEBUG,
-        forced_return::FORCED_RETURN,
     ]);
 
     reg.register_lint_group("clippy::pedantic", Some("clippy_pedantic"), vec![
diff --git a/clippy_lints/src/forced_return.rs b/clippy_lints/src/missing_returns.rs
index ee30bd0ab1e..8a4d37a98ac 100644
--- a/clippy_lints/src/forced_return.rs
+++ b/clippy_lints/src/missing_returns.rs
@@ -16,8 +16,8 @@ use crate::utils::{snippet_opt, span_lint_and_then};
 
 /// **What it does:** Checks for missing return statements at the end of a block.
 ///
-/// **Why is this bad?** Actually it is idiomatic Rust code. Programmers coming
-/// from other languages might prefer the expressiveness of `return`.
+/// **Why is this bad?** Actually omitting the return keyword is idiomatic Rust code. Programmers
+/// coming from other languages might prefer the expressiveness of `return`.
 ///
 /// **Known problems:** None.
 ///
@@ -34,16 +34,16 @@ use crate::utils::{snippet_opt, span_lint_and_then};
 /// }
 /// ```
 declare_clippy_lint! {
-    pub FORCED_RETURN,
+    pub MISSING_RETURNS,
     restriction,
     "use a return statement like `return expr` instead of an expression"
 }
 
-pub struct ForcedReturnPass;
+pub struct MissingReturnsPass;
 
-impl ForcedReturnPass {
+impl MissingReturnsPass {
     fn show_suggestion(cx: &LateContext<'_, '_>, span: syntax_pos::Span) {
-        span_lint_and_then(cx, FORCED_RETURN, span, "missing return statement", |db| {
+        span_lint_and_then(cx, MISSING_RETURNS, span, "missing return statement", |db| {
             if let Some(snippet) = snippet_opt(cx, span) {
                 db.span_suggestion_with_applicability(
                     span,
@@ -80,13 +80,13 @@ impl ForcedReturnPass {
     }
 }
 
-impl LintPass for ForcedReturnPass {
+impl LintPass for MissingReturnsPass {
     fn get_lints(&self) -> LintArray {
-        lint_array!(FORCED_RETURN)
+        lint_array!(MISSING_RETURNS)
     }
 }
 
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ForcedReturnPass {
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingReturnsPass {
     fn check_fn(
         &mut self,
         cx: &LateContext<'a, 'tcx>,
diff --git a/tests/ui/forced_return.rs b/tests/ui/missing_returns.rs
index 5f07d99528e..96935eb6b53 100644
--- a/tests/ui/forced_return.rs
+++ b/tests/ui/missing_returns.rs
@@ -11,7 +11,7 @@
 
 
 
-#![warn(clippy::forced_return)]
+#![warn(clippy::missing_returns)]
 
 fn test_end_of_fn() -> bool {
     if true {
diff --git a/tests/ui/forced_return.stderr b/tests/ui/missing_returns.stderr
index 0b1dcc4ce33..874bec9e109 100644
--- a/tests/ui/forced_return.stderr
+++ b/tests/ui/missing_returns.stderr
@@ -1,43 +1,43 @@
 error: missing return statement
-  --> $DIR/forced_return.rs:21:5
+  --> $DIR/missing_returns.rs:21:5
    |
 21 |     true
    |     ^^^^ help: add `return` as shown: `return true`
    |
-   = note: `-D clippy::forced-return` implied by `-D warnings`
+   = note: `-D clippy::missing-returns` implied by `-D warnings`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:27:9
+  --> $DIR/missing_returns.rs:27:9
    |
 27 |         true
    |         ^^^^ help: add `return` as shown: `return true`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:29:9
+  --> $DIR/missing_returns.rs:29:9
    |
 29 |         false
    |         ^^^^^ help: add `return` as shown: `return false`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:36:17
+  --> $DIR/missing_returns.rs:36:17
    |
 36 |         true => false,
    |                 ^^^^^ help: add `return` as shown: `return false`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:38:13
+  --> $DIR/missing_returns.rs:38:13
    |
 38 |             true
    |             ^^^^ help: add `return` as shown: `return true`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:45:9
+  --> $DIR/missing_returns.rs:45:9
    |
 45 |         true
    |         ^^^^ help: add `return` as shown: `return true`
 
 error: missing return statement
-  --> $DIR/forced_return.rs:47:16
+  --> $DIR/missing_returns.rs:47:16
    |
 47 |     let _ = || true;
    |                ^^^^ help: add `return` as shown: `return true`