Warn if non-trivial work is done inside .expect

- added tests for common usages of format and as_str arguments to expect
- added tests for usages of Option and Result types
- given performance impact of passing non literal expressions to expect, added to perf group
This commit is contained in:
Donald Robertson
2018-05-28 21:00:45 +02:00
parent 3d7cdd4ac5
commit 05c1ccebaf
4 changed files with 153 additions and 26 deletions

View File

@@ -590,6 +590,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
methods::OK_EXPECT,
methods::OPTION_MAP_OR_NONE,
methods::OR_FUN_CALL,
methods::EXPECT_FUN_CALL,
methods::SEARCH_IS_SOME,
methods::SHOULD_IMPLEMENT_TRAIT,
methods::SINGLE_CHAR_PATTERN,
@@ -899,6 +900,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
loops::UNUSED_COLLECT,
methods::ITER_NTH,
methods::OR_FUN_CALL,
methods::EXPECT_FUN_CALL,
methods::SINGLE_CHAR_PATTERN,
misc::CMP_OWNED,
mutex_atomic::MUTEX_ATOMIC,