Files
rust/tests/ui
Nick Mathewson 3d41358a55 wrong_self_convention: Match SelfKind::No more restrictively
The `wrong_self_convention` lint uses a `SelfKind` type to decide
whether a method has the right kind of "self" for its name, or whether
the kind of "self" it has makes its name confusable for a method in
a common trait.  One possibility is `SelfKind::No`, which is supposed
to mean "No `self`".

Previously, SelfKind::No matched everything _except_ Self, including
references to Self.  This patch changes it to match Self, &Self, &mut
Self, Box<Self>, and so on.

For example, this kind of method was allowed before:

```
impl S {
    // Should trigger the lint, because
    // "methods called `is_*` usually take `self` by reference or no `self`"
    fn is_foo(&mut self) -> bool { todo!() }
}
```

But since SelfKind::No matched "&mut self", no lint was triggered
(see #8142).

With this patch, the code above now gives a lint as expected.

Fixes #8142

changelog: [`wrong_self_convention`] rejects `self` references in more cases
2021-12-31 23:39:40 -05:00
..
2021-12-13 14:02:41 +11:00
2021-12-25 00:29:29 +09:00
2021-12-25 00:29:24 +09:00
2021-12-13 00:00:51 +00:00
2021-12-13 00:00:51 +00:00
2021-08-11 14:21:33 +00:00
2019-01-08 21:46:39 +01:00
2021-08-11 14:21:33 +00:00
2020-11-08 18:32:12 -05:00
2021-06-18 16:11:32 +08:00
2021-06-18 16:11:32 +08:00
2021-06-18 16:11:32 +08:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-01-07 18:38:12 +09:00
2019-12-21 16:20:30 +01:00
2021-08-11 14:21:33 +00:00
2021-12-13 00:00:51 +00:00
2021-12-13 00:00:51 +00:00
2021-12-25 21:55:20 +08:00
2021-08-11 14:21:33 +00:00
2021-12-29 09:05:04 -08:00
2021-12-29 09:05:04 -08:00
2021-08-11 14:21:33 +00:00
2019-11-07 17:11:06 +01:00
2019-11-07 17:11:06 +01:00
2019-11-07 17:11:06 +01:00
2019-11-07 17:11:06 +01:00
2019-11-07 17:11:06 +01:00
2020-01-12 19:54:17 +08:00
2020-01-12 19:54:17 +08:00
2020-02-23 22:36:15 -08:00
2021-08-11 14:21:33 +00:00
2021-12-13 17:09:16 +00:00
2020-11-08 18:32:12 -05:00
2020-04-20 15:47:08 -04:00
2020-01-07 18:38:12 +09:00
2019-12-24 03:06:52 +07:00
2019-12-24 03:06:52 +07:00
2020-11-08 18:32:12 -05:00
2020-01-04 11:20:11 -06:00
2020-01-04 11:20:11 -06:00
2019-10-15 09:58:11 +02:00
2020-01-26 07:01:16 +09:00
2021-12-26 21:37:57 +08:00
2021-12-26 21:37:57 +08:00
2021-12-26 21:37:57 +08:00
2021-12-26 21:37:57 +08:00
2021-12-26 21:37:57 +08:00
2020-01-07 18:38:12 +09:00
2019-08-01 22:20:08 +09:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-01-14 08:32:33 +09:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-11-08 18:32:12 -05:00
2019-10-15 09:58:11 +02:00
2021-08-11 14:21:33 +00:00
2020-01-07 18:38:12 +09:00
2020-04-23 16:30:06 -07:00
2021-08-11 14:21:33 +00:00
2020-04-26 18:00:51 +03:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-01-07 18:38:12 +09:00
2019-12-31 09:22:35 -08:00
2021-08-11 14:21:33 +00:00
2021-12-22 17:25:44 +01:00
2021-06-04 08:05:54 -04:00
2021-12-13 00:00:51 +00:00
2021-12-13 00:00:51 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-12-23 10:51:17 +01:00
2021-12-23 10:51:17 +01:00
2021-12-23 10:51:17 +01:00
2021-08-11 14:21:33 +00:00
2020-01-26 07:01:16 +09:00
2020-01-07 18:38:12 +09:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2019-01-08 21:46:39 +01:00
2019-12-18 18:59:43 +02:00
2020-03-20 22:52:53 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-01-20 10:56:02 +09:00
2019-10-15 09:58:11 +02:00
2019-10-15 09:58:11 +02:00
2020-09-10 15:23:38 +02:00
2019-11-10 15:52:59 +02:00
2021-12-12 12:34:21 +00:00
2021-12-12 12:34:21 +00:00
2020-11-08 18:32:12 -05:00
2021-07-27 16:26:50 -04:00
2021-07-27 16:26:50 -04:00
2019-04-02 11:39:43 -03:00
2019-11-25 18:12:52 +03:00
2019-11-25 18:12:52 +03:00
2020-01-07 18:38:12 +09:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2019-12-27 22:07:55 +09:00
2019-12-27 22:07:55 +09:00
2021-03-03 11:23:29 +01:00
2021-08-11 14:21:33 +00:00
2019-08-14 19:34:50 +02:00
2019-08-14 19:34:50 +02:00
2019-08-14 19:35:17 +02:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2020-01-07 18:38:12 +09:00
2020-03-29 22:22:36 +02:00
2021-12-23 21:41:25 -08:00
2021-12-23 21:43:44 -08:00
2020-03-10 18:00:37 -04:00
2020-03-10 18:00:37 -04:00
2019-05-08 09:24:24 +02:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2021-08-11 14:21:33 +00:00
2019-10-02 22:38:00 +07:00