Finn Evers
12b012eab3
language: Further optimize language_for_file ( #28694 )
...
Follow-up to #28671
This primarily follows two ideas:
1. We currently take the element with the highest score which appears
last in the iterator (see
[`last_by_key`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.max_by_key )),
so we can also just reverse the iterator and take the first highest
match instead.
2. Once we have a match with a given precedence, we are not interested
in any matches with a lower or even the same priority, given what was
established in 1. Thus, we also only have to check whether any language
checked afterwards has a higher priority match.
Furthermore, once we have a match with the highest possible precedence,
there is no need to look for any more possible matches. Thus, this PR
also adds short-circuiting for that scenario.
Lastly, I also cleaned-up the custom suffix match (an empty glob-set
will never match so no need to iterate there) as well reorder the
zip-call in the content matches, as we never need the content if there
is no first line pattern present for the checked languages.
Release Notes:
- N/A
2025-04-14 23:31:45 +00:00
..
2025-04-07 18:10:01 +00:00
2025-04-14 20:18:18 -03:00
2025-04-14 22:05:46 +00:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-05 17:10:39 +00:00
2025-04-09 17:13:41 +00:00
2025-04-11 00:01:33 +00:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:55:25 +02:00
2025-04-14 21:55:25 +02:00
2025-04-02 13:26:34 -07:00
2025-04-14 10:36:31 -07:00
2025-04-14 10:36:31 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-05 11:16:26 -04:00
2025-04-07 20:26:55 +00:00
2025-04-10 22:58:41 +00:00
2025-04-08 16:01:27 +00:00
2025-04-02 13:26:34 -07:00
2025-04-11 17:38:14 +00:00
2025-04-08 09:17:08 -06:00
2025-04-02 13:26:34 -07:00
2025-04-14 17:44:00 +05:30
2025-04-09 14:34:51 -06:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-11 11:43:57 -04:00
2025-04-11 11:43:57 -04:00
2025-04-14 21:55:25 +02:00
2025-04-02 13:26:34 -07:00
2025-04-14 15:33:22 -04:00
2025-04-02 13:26:34 -07:00
2025-04-09 12:57:24 +02:00
2025-04-11 16:36:54 +02:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-11 17:40:25 +00:00
2025-04-02 13:26:34 -07:00
2025-04-04 17:37:42 -06:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:22:27 +00:00
2025-04-14 23:04:07 +00:00
2025-04-02 13:26:34 -07:00
2025-04-11 22:01:25 +00:00
2025-03-31 20:55:27 +02:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-10 15:07:48 -05:00
2025-04-02 13:26:34 -07:00
2025-04-11 23:02:50 +00:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:07:19 +05:30
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:07:19 +05:30
2025-04-02 13:26:34 -07:00
2025-04-14 21:07:19 +05:30
2025-04-10 23:22:27 +00:00
2025-04-14 22:01:21 +00:00
2025-04-11 16:26:41 -06:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-11 23:02:50 +00:00
2025-04-02 13:26:34 -07:00
2025-04-10 21:16:43 +00:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-11 01:47:40 +05:30
2025-04-02 13:26:34 -07:00
2025-04-14 23:31:45 +00:00
2025-04-02 13:26:34 -07:00
2025-04-14 20:18:47 +00:00
2025-04-11 23:55:23 +00:00
2025-04-14 15:33:22 -04:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:22:27 +00:00
2025-04-02 13:26:34 -07:00
2025-04-08 16:01:27 +00:00
2025-04-02 13:26:34 -07:00
2025-04-07 10:35:11 -06:00
2025-04-10 21:49:08 +00:00
2025-04-02 13:26:34 -07:00
2025-04-07 18:46:09 +00:00
2025-04-02 13:26:34 -07:00
2025-04-09 23:38:36 -06:00
2025-04-02 13:26:34 -07:00
2025-04-14 15:09:28 -03:00
2025-04-10 21:16:43 +00:00
2025-04-08 16:09:06 -06:00
2025-04-02 13:26:34 -07:00
2025-04-14 16:15:59 -03:00
2025-04-10 23:22:27 +00:00
2025-04-10 23:22:27 +00:00
2025-04-02 13:26:34 -07:00
2025-04-12 12:54:47 +00:00
2025-04-11 23:02:50 +00:00
2025-04-02 13:26:34 -07:00
2025-04-14 18:25:18 +00:00
2025-04-11 17:26:39 +00:00
2025-04-02 13:26:34 -07:00
2025-04-11 23:02:50 +00:00
2025-04-11 00:01:33 +00:00
2025-04-14 21:07:19 +05:30
2025-04-11 21:34:51 +00:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-08 22:16:35 -04:00
2025-04-08 09:17:08 -06:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-03 23:32:50 +02:00
2025-04-08 22:16:27 +02:00
2025-04-02 13:26:34 -07:00
2025-04-09 20:43:53 -06:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-08 16:09:06 -06:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-08 15:57:36 -06:00
2025-04-09 23:38:36 -06:00
2025-04-10 22:29:03 +00:00
2025-04-02 13:26:34 -07:00
2025-04-04 19:28:32 -04:00
2025-04-09 23:38:36 -06:00
2025-04-08 22:16:27 +02:00
2025-04-09 01:53:54 +00:00
2025-04-09 10:49:39 -04:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-02 13:26:34 -07:00
2025-04-11 16:18:36 +00:00
2025-04-02 13:26:34 -07:00
2025-04-14 21:07:19 +05:30
2025-04-08 16:09:06 -06:00
2025-04-08 16:09:06 -06:00
2025-04-07 19:03:24 +00:00
2025-04-09 23:38:36 -06:00
2025-04-02 13:26:34 -07:00
2025-04-11 16:03:05 -06:00
2025-04-02 13:26:34 -07:00
2025-04-11 01:47:40 +05:30
2025-04-11 21:34:51 +00:00
2025-04-12 12:54:47 +00:00
2025-04-14 16:21:19 -04:00
2025-04-05 17:10:39 +00:00
2025-04-09 14:21:07 -03:00
2025-04-14 19:44:03 +00:00
2025-04-14 14:17:07 +00:00