ruff/crates
Dhruv Manilawala 4667d8697c
Remove duplication around is_trivia functions (#11956)
## Summary

This PR removes the duplication around `is_trivia` functions.

There are two of them in the codebase:
1. In `pycodestyle`, it's for newline, indent, dedent, non-logical
newline and comment
2. In the parser, it's for non-logical newline and comment

The `TokenKind::is_trivia` method used (1) but that's not correct in
that context. So, this PR introduces a new `is_non_logical_token` helper
method for the `pycodestyle` crate and updates the
`TokenKind::is_trivia` implementation with (2).

This also means we can remove `Token::is_trivia` method and the
standalone `token_source::is_trivia` function and use the one on
`TokenKind`.

## Test Plan

`cargo insta test`
2024-06-21 10:02:40 +00:00
..
red_knot [red-knot] Extract red_knot_python_semantic crate (#11926) 2024-06-20 13:24:24 +02:00
red_knot_python_semantic [red-knot] Upgrade to Salsa 3.0 (#11952) 2024-06-20 20:19:16 +01:00
ruff ruff-check: update docs for fix_only (#11959) 2024-06-21 08:13:04 +02:00
ruff_benchmark Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_cache Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_db [red-knot] Upgrade to Salsa 3.0 (#11952) 2024-06-20 20:19:16 +01:00
ruff_dev Maintain synchronicity between the lexer and the parser (#11457) 2024-06-03 18:23:50 +05:30
ruff_diagnostics Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_formatter Fix formatter instability for lines only consisting of zero-width characters (#11748) 2024-06-05 17:55:14 +02:00
ruff_index Red-knot: Track scopes per expression (#11754) 2024-06-05 17:53:26 +02:00
ruff_linter Remove duplication around is_trivia functions (#11956) 2024-06-21 10:02:40 +00:00
ruff_macros Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_notebook Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
ruff_python_ast red-knot: source_text, line_index, and parsed_module queries (#11822) 2024-06-13 07:37:02 +00:00
ruff_python_ast_integration_tests Rename PreorderVisitor to SourceOrderVisitor (#11798) 2024-06-07 17:01:58 +00:00
ruff_python_codegen Avoid depth counting when detecting indentation (#11947) 2024-06-20 10:42:35 +05:30
ruff_python_formatter Upgrade to Rust 1.79 (#11875) 2024-06-17 07:15:10 +01:00
ruff_python_index Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_python_literal Remove some unused pub functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_parser Remove duplication around is_trivia functions (#11956) 2024-06-21 10:02:40 +00:00
ruff_python_resolver chore(deps): update rust crate insta to v1.38.0 (#10701) 2024-04-01 15:44:30 +00:00
ruff_python_semantic [red-knot] Extract red_knot_python_semantic crate (#11926) 2024-06-20 13:24:24 +02:00
ruff_python_stdlib Regenerate sys.rs with stdlibs==2024.5.15 (#11437) 2024-05-15 22:17:32 +00:00
ruff_python_trivia Move has_comments to CommentRanges (#11495) 2024-05-22 13:35:16 +00:00
ruff_python_trivia_integration_tests Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_server Add Jupyter Notebook document change snapshot test (#11944) 2024-06-21 05:29:27 +00:00
ruff_source_file red-knot: source_text, line_index, and parsed_module queries (#11822) 2024-06-13 07:37:02 +00:00
ruff_text_size Upgrade to Rust 1.79 (#11875) 2024-06-17 07:15:10 +01:00
ruff_wasm Build CommentRanges outside the parser (#11792) 2024-06-09 09:55:17 +00:00
ruff_workspace Respect file exclusions in ruff server (#11590) 2024-05-29 02:58:36 +00:00