Commit 930f48c
refactor(rust-guard): extract is_any_trusted_actor helper and collapse URL fallback loop
- Add is_any_trusted_actor(username, ctx) helper combining the three
constituent trust predicates (first-party bot, configured bot,
trusted user); replaces copy-pasted triple-OR at three call sites in
helpers.rs and tool_rules.rs
- Replace three structurally identical if-let blocks in
extract_repo_from_item with a for-field loop over
["repository_url", "html_url", "url"], matching the idiom already
used in extract_number_from_url
All 317 Rust guard tests pass.
Closes #4252
Co-authored-by: Copilot <[email protected]>1 parent baa83f9 commit 930f48c
2 files changed
Lines changed: 19 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
993 | 982 | | |
994 | 983 | | |
995 | 984 | | |
| |||
1278 | 1267 | | |
1279 | 1268 | | |
1280 | 1269 | | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
| 1270 | + | |
1286 | 1271 | | |
1287 | 1272 | | |
1288 | 1273 | | |
| |||
1476 | 1461 | | |
1477 | 1462 | | |
1478 | 1463 | | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
| 1464 | + | |
1483 | 1465 | | |
1484 | 1466 | | |
1485 | 1467 | | |
| |||
1772 | 1754 | | |
1773 | 1755 | | |
1774 | 1756 | | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
1775 | 1765 | | |
1776 | 1766 | | |
1777 | 1767 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 98 | + | |
102 | 99 | | |
103 | 100 | | |
104 | 101 | | |
| |||
0 commit comments