Move Ranged into ruff_text_size (#6919)

## Summary

The motivation here is that this enables us to implement `Ranged` in
crates that don't depend on `ruff_python_ast`.

Largely a mechanical refactor with a lot of regex, Clippy help, and
manual fixups.

## Test Plan

`cargo test`
This commit is contained in:
Charlie Marsh 2023-08-27 14:12:51 -04:00 committed by GitHub
parent 88c8bece38
commit fc89976c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
468 changed files with 940 additions and 706 deletions

View file

@ -95,7 +95,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -122,7 +122,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -152,7 +152,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -176,7 +176,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -199,7 +199,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -222,7 +222,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -246,7 +246,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -278,7 +278,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -302,7 +302,7 @@ impl<'a> Locator<'a> {
/// Returns true if the text of `range` contains any line break.
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -327,7 +327,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");
@ -355,7 +355,7 @@ impl<'a> Locator<'a> {
/// ## Examples
///
/// ```
/// # use ruff_text_size::{TextRange, TextSize};
/// # use ruff_text_size::{Ranged, TextRange, TextSize};
/// # use ruff_source_file::Locator;
///
/// let locator = Locator::new("First line\nsecond line\r\nthird line");