diff --git a/README.md b/README.md index 8e8a2627557e..0a4f83ffee62 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ name [match_overlapping_arm](https://github.com/Manishearth/rust-clippy/wiki#match_overlapping_arm) | warn | a match has overlapping arms [match_ref_pats](https://github.com/Manishearth/rust-clippy/wiki#match_ref_pats) | warn | a match or `if let` has all arms prefixed with `&`; the match expression can be dereferenced instead [match_same_arms](https://github.com/Manishearth/rust-clippy/wiki#match_same_arms) | warn | `match` with identical arm bodies -[mem_forget](https://github.com/Manishearth/rust-clippy/wiki#mem_forget) | allow | `std::mem::forget` usage is likely to cause memory leaks +[mem_forget](https://github.com/Manishearth/rust-clippy/wiki#mem_forget) | allow | `mem::forget` usage is likely to cause memory leaks [min_max](https://github.com/Manishearth/rust-clippy/wiki#min_max) | warn | `min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant [modulo_one](https://github.com/Manishearth/rust-clippy/wiki#modulo_one) | warn | taking a number modulo 1, which always returns 0 [mut_mut](https://github.com/Manishearth/rust-clippy/wiki#mut_mut) | allow | usage of double-mut refs, e.g. `&mut &mut ...` (either copy'n'paste error, or shows a fundamental misunderstanding of references) diff --git a/src/mem_forget.rs b/src/mem_forget.rs index 651e56d709f4..d857adf10d65 100644 --- a/src/mem_forget.rs +++ b/src/mem_forget.rs @@ -8,11 +8,11 @@ use utils::{match_def_path, paths, span_lint}; /// /// **Known problems:** None. /// -/// **Example:** `std::mem::forget(_))` +/// **Example:** `mem::forget(_))` declare_lint! { pub MEM_FORGET, Allow, - "`std::mem::forget` usage is likely to cause memory leaks" + "`mem::forget` usage is likely to cause memory leaks" } pub struct MemForget; @@ -30,7 +30,7 @@ impl LateLintPass for MemForget { let def_id = cx.tcx.def_map.borrow()[&path_expr.id].def_id(); if match_def_path(cx, def_id, &paths::MEM_FORGET) { - span_lint(cx, MEM_FORGET, e.span, "usage of std::mem::forget"); + span_lint(cx, MEM_FORGET, e.span, "usage of mem::forget"); } } } diff --git a/tests/compile-fail/mem_forget.rs b/tests/compile-fail/mem_forget.rs index 1b9cc810f968..5198b4ea8d3a 100644 --- a/tests/compile-fail/mem_forget.rs +++ b/tests/compile-fail/mem_forget.rs @@ -10,12 +10,12 @@ use std::mem as memstuff; fn main() { let five: i32 = 5; forgetSomething(five); - //~^ ERROR usage of std::mem::forget + //~^ ERROR usage of mem::forget let six: Arc = Arc::new(6); memstuff::forget(six); - //~^ ERROR usage of std::mem::forget + //~^ ERROR usage of mem::forget std::mem::forget(7); - //~^ ERROR usage of std::mem::forget + //~^ ERROR usage of mem::forget }