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
use rustc_session::{declare_lint_pass, declare_tool_lint};
7
+
8
+
declare_clippy_lint!{
9
+
/// **What it does:** Searches for implementations of the `Into<..>` trait and suggests to implement `From<..>` instead.
10
+
///
11
+
/// **Why is this bad?** According the std docs implementing `From<..>` is preferred since it gives you `Into<..>` for free where the reverse isn't true.
12
+
///
13
+
/// **Known problems:** None.
14
+
///
15
+
/// **Example:**
16
+
///
17
+
/// ```rust
18
+
/// struct StringWrapper(String);
19
+
///
20
+
/// impl Into<StringWrapper> for String {
21
+
/// fn into(self) -> StringWrapper {
22
+
/// StringWrapper(self)
23
+
/// }
24
+
/// }
25
+
/// ```
26
+
/// Use instead:
27
+
/// ```rust
28
+
/// struct StringWrapper(String);
29
+
///
30
+
/// impl From<String> for StringWrapper {
31
+
/// fn from(s: String) -> StringWrapper {
32
+
/// StringWrapper(s)
33
+
/// }
34
+
/// }
35
+
/// ```
36
+
pubFROM_OVER_INTO,
37
+
style,
38
+
"Warns on implementations of `Into<..>` to use `From<..>`"
0 commit comments