You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[single_char_pattern](https://github.com/Manishearth/rust-clippy/wiki#single_char_pattern) | warn | using a single-character str where a char could be used, e.g. `_.split("x")`
125
125
[single_match](https://github.com/Manishearth/rust-clippy/wiki#single_match) | warn | a match statement with a single nontrivial arm (i.e, where the other arm is `_ => {}`) is used; recommends `if let` instead
126
126
[single_match_else](https://github.com/Manishearth/rust-clippy/wiki#single_match_else) | allow | a match statement with a two arms where the second arm's pattern is a wildcard; recommends `if let` instead
127
-
[str_to_string](https://github.com/Manishearth/rust-clippy/wiki#str_to_string) | warn | using `to_string()` on a str, which should be `to_owned()`
128
127
[string_add](https://github.com/Manishearth/rust-clippy/wiki#string_add) | allow | using `x + ..` where x is a `String`; suggests using `push_str()` instead
129
128
[string_add_assign](https://github.com/Manishearth/rust-clippy/wiki#string_add_assign) | allow | using `x = x + ..` where x is a `String`; suggests using `push_str()` instead
130
129
[string_lit_as_bytes](https://github.com/Manishearth/rust-clippy/wiki#string_lit_as_bytes) | warn | calling `as_bytes` on a string literal; suggests using a byte string literal instead
131
-
[string_to_string](https://github.com/Manishearth/rust-clippy/wiki#string_to_string) | warn | calling `String::to_string` which is inefficient
132
130
[suspicious_assignment_formatting](https://github.com/Manishearth/rust-clippy/wiki#suspicious_assignment_formatting) | warn | suspicious formatting of `*=`, `-=` or `!=`
133
131
[suspicious_else_formatting](https://github.com/Manishearth/rust-clippy/wiki#suspicious_else_formatting) | warn | suspicious formatting of `else if`
134
132
[temporary_assignment](https://github.com/Manishearth/rust-clippy/wiki#temporary_assignment) | warn | assignments to temporaries
@@ -140,8 +138,6 @@ name
140
138
[unit_cmp](https://github.com/Manishearth/rust-clippy/wiki#unit_cmp) | warn | comparing unit values (which is always `true` or `false`, respectively)
141
139
[unnecessary_mut_passed](https://github.com/Manishearth/rust-clippy/wiki#unnecessary_mut_passed) | warn | an argument is passed as a mutable reference although the function/method only demands an immutable reference
142
140
[unneeded_field_pattern](https://github.com/Manishearth/rust-clippy/wiki#unneeded_field_pattern) | warn | Struct fields are bound to a wildcard instead of using `..`
143
-
[unstable_as_mut_slice](https://github.com/Manishearth/rust-clippy/wiki#unstable_as_mut_slice) | warn | as_mut_slice is not stable and can be replaced by &mut v[..]see https://github.com/rust-lang/rust/issues/27729
144
-
[unstable_as_slice](https://github.com/Manishearth/rust-clippy/wiki#unstable_as_slice) | warn | as_slice is not stable and can be replaced by & v[..]see https://github.com/rust-lang/rust/issues/27729
145
141
[unused_collect](https://github.com/Manishearth/rust-clippy/wiki#unused_collect) | warn | `collect()`ing an iterator without using the result; this is usually better written as a for loop
use utils::{BTREEMAP_ENTRY_PATH,DEFAULT_TRAIT_PATH,HASHMAP_ENTRY_PATH,OPTION_PATH,RESULT_PATH,STRING_PATH,
15
+
use utils::{BTREEMAP_ENTRY_PATH,DEFAULT_TRAIT_PATH,HASHMAP_ENTRY_PATH,OPTION_PATH,RESULT_PATH,
16
16
VEC_PATH};
17
17
use utils::MethodArgs;
18
18
@@ -45,31 +45,6 @@ declare_lint! {
45
45
"using `Result.unwrap()`, which might be better handled"
46
46
}
47
47
48
-
/// **What it does:** This lint checks for `.to_string()` method calls on values of type `&str`.
49
-
///
50
-
/// **Why is this bad?** This uses the whole formatting machinery just to clone a string. Using `.to_owned()` is lighter on resources. You can also consider using a [`Cow<'a, str>`](http://doc.rust-lang.org/std/borrow/enum.Cow.html) instead in some cases.
51
-
///
52
-
/// **Known problems:** None
53
-
///
54
-
/// **Example:** `s.to_string()` where `s: &str`
55
-
declare_lint!{
56
-
pubSTR_TO_STRING,Warn,
57
-
"using `to_string()` on a str, which should be `to_owned()`"
58
-
}
59
-
60
-
/// **What it does:** This lint checks for `.to_string()` method calls on values of type `String`.
61
-
///
62
-
/// **Why is this bad?** This is an non-efficient way to clone a `String`, `.clone()` should be used
63
-
/// instead. `String` implements `ToString` mostly for generics.
64
-
///
65
-
/// **Known problems:** None
66
-
///
67
-
/// **Example:** `s.to_string()` where `s: String`
68
-
declare_lint!{
69
-
pubSTRING_TO_STRING,Warn,
70
-
"calling `String::to_string` which is inefficient"
71
-
}
72
-
73
48
/// **What it does:** This lint checks for methods that should live in a trait implementation of a `std` trait (see [llogiq's blog post](http://llogiq.github.io/2015/07/30/traits.html) for further information) instead of an inherent implementation.
74
49
///
75
50
/// **Why is this bad?** Implementing the traits improve ergonomics for users of the code, often with very little cost. Also people seeing a `mul(..)` method may expect `*` to work equally, so you should have good reason to disappoint them.
@@ -315,8 +290,6 @@ impl LintPass for MethodsPass {
315
290
lint_array!(EXTEND_FROM_SLICE,
316
291
OPTION_UNWRAP_USED,
317
292
RESULT_UNWRAP_USED,
318
-
STR_TO_STRING,
319
-
STRING_TO_STRING,
320
293
SHOULD_IMPLEMENT_TRAIT,
321
294
WRONG_SELF_CONVENTION,
322
295
WRONG_PUB_SELF_CONVENTION,
@@ -343,8 +316,6 @@ impl LateLintPass for MethodsPass {
0 commit comments