Charlie Marsh
4c4eceee36
Add dangling comment handling for lambda expressions (#7493)
## Summary
This PR adds dangling comment handling for `lambda` expressions. In
short, comments around the `lambda` and the `:` are all considered
dangling. Comments that come between the `lambda` and the `:` may be
moved after the colon for simplicity (this is an odd position for a
comment anyway), unless they also precede the lambda parameters, in
which case they're formatted before the parameters.
Closes https://github.com/astral-sh/ruff/issues/7470.
## Test Plan
`cargo test`
No change in similarity.
Before:
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1632 |
| django | 0.99982 | 2760 | 37 |
| transformers | 0.99957 | 2587 | 398 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99983 | 3496 | 18 |
| warehouse | 0.99929 | 648 | 16 |
| zulip | 0.99962 | 1437 | 22 |
After:
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1632 |
| django | 0.99982 | 2760 | 37 |
| transformers | 0.99957 | 2587 | 398 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99983 | 3496 | 18 |
| warehouse | 0.99929 | 648 | 16 |
| zulip | 0.99962 | 1437 | 22 |
2023-09-19 15:23:51 -04:00
..
2023-08-30 04:11:58 +00:00
2023-06-30 06:32:50 +00:00
2023-08-01 08:26:30 +02:00
2023-08-31 20:55:05 +00:00
2023-08-14 12:28:58 +00:00
2023-08-01 08:26:30 +02:00
2023-07-11 16:40:28 +02:00
2023-08-24 09:47:57 +00:00
2023-06-30 06:32:50 +00:00
2023-08-01 08:26:30 +02:00
2023-08-16 15:05:51 +00:00
2023-07-29 10:06:26 -04:00
2023-08-28 08:09:17 +00:00
2023-08-26 14:45:44 +00:00
2023-07-19 13:01:58 +02:00
2023-07-24 07:04:40 +00:00
2023-06-30 06:32:50 +00:00
2023-08-15 07:15:33 -04:00
2023-09-01 06:34:51 +00:00
2023-07-31 16:58:15 -04:00
2023-08-30 16:03:17 +02:00
2023-08-30 16:03:17 +02:00
2023-08-14 12:28:58 +00:00
2023-09-14 08:43:53 +00:00
2023-08-14 15:57:36 +00:00
2023-08-31 20:55:05 +00:00
2023-08-31 20:55:05 +00:00
2023-08-31 20:55:05 +00:00
2023-07-11 16:51:24 +02:00
2023-08-01 15:30:59 +00:00
2023-08-04 13:58:01 +00:00
2023-07-26 16:21:23 +00:00
2023-08-15 18:59:18 +00:00
2023-08-30 08:07:11 +00:00
2023-07-10 21:23:49 +02:00
2023-07-19 11:47:56 +00:00
2023-08-15 18:59:18 +00:00
2023-09-01 06:34:51 +00:00
2023-07-11 14:07:39 +02:00
2023-08-24 14:09:25 +02:00
2023-07-31 10:46:40 +02:00
2023-06-30 10:13:23 +02:00
2023-09-19 16:16:40 +02:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-09-18 06:08:10 +00:00
2023-07-11 16:40:28 +02:00
2023-09-14 05:05:37 -04:00
2023-09-18 09:56:41 -04:00
2023-09-12 09:49:51 +02:00
2023-09-14 15:36:21 +00:00
2023-09-12 06:39:57 +00:00
2023-09-19 16:16:40 +02:00
2023-09-16 16:21:45 +02:00
2023-09-14 08:43:53 +00:00
2023-09-19 19:17:21 +00:00
2023-09-19 19:17:21 +00:00
2023-09-01 16:27:32 +00:00
2023-09-08 10:53:34 +02:00
2023-08-30 04:11:58 +00:00
2023-09-19 15:23:51 -04:00
2023-09-16 17:19:34 +00:00
2023-08-25 00:18:05 -04:00
2023-08-21 16:29:26 +02:00
2023-07-20 10:07:22 +00:00
2023-09-14 13:04:14 +02:00
2023-08-11 17:58:42 +00:00
2023-08-16 13:41:07 +00:00
2023-09-19 16:16:40 +02:00
2023-09-14 05:05:37 -04:00
2023-08-30 08:07:11 +00:00
2023-09-16 13:07:38 -04:00
2023-09-19 06:29:05 +00:00
2023-07-21 12:07:51 +00:00
2023-09-16 14:46:56 -04:00
2023-08-15 08:00:35 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-14 15:57:36 +00:00
2023-09-19 16:16:40 +02:00
2023-08-31 20:55:05 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-14 15:57:36 +00:00
2023-08-17 05:58:19 +00:00
2023-08-17 05:58:19 +00:00
2023-08-25 19:03:37 +00:00
2023-08-17 06:05:41 +00:00
2023-08-17 06:05:41 +00:00
2023-08-21 17:45:23 +02:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-08-31 20:55:05 +00:00
2023-09-04 10:57:04 +01:00
2023-09-12 06:39:57 +00:00
2023-08-23 00:44:33 +00:00
2023-08-23 00:40:18 -04:00
2023-09-19 16:16:40 +02:00
2023-07-13 10:51:25 +00:00
2023-08-31 20:55:05 +00:00
2023-09-19 16:16:40 +02:00
2023-09-16 16:21:45 +02:00
2023-07-13 10:51:25 +00:00
2023-06-26 14:15:55 +02:00
2023-08-30 08:20:28 +02:00
2023-08-30 08:07:11 +00:00
2023-08-23 14:01:14 +00:00
2023-08-22 12:18:59 +02:00
2023-08-31 20:55:05 +00:00
2023-08-02 19:55:00 +00:00
2023-08-11 11:21:16 +00:00
2023-08-15 07:15:33 -04:00
2023-08-22 12:27:40 -04:00
2023-08-30 09:52:51 -04:00
2023-09-17 14:56:41 +00:00
2023-08-02 19:55:00 +00:00
2023-08-15 18:59:18 +00:00
2023-09-16 16:21:45 +02:00
2023-08-29 08:30:05 +02:00
2023-08-15 09:33:57 +02:00
2023-08-21 09:02:23 +02:00
2023-08-30 08:07:11 +00:00
2023-08-02 20:40:32 +00:00
2023-08-30 08:07:11 +00:00
2023-08-18 03:30:38 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-11 08:03:59 +00:00
2023-09-19 16:16:40 +02:00
2023-09-01 14:52:59 +02:00
2023-06-26 14:15:55 +02:00