mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:09:22 +00:00
Bump MSRV to Rust 1.80 (#13826)
This commit is contained in:
parent
075e378b0f
commit
27c50bebec
42 changed files with 110 additions and 133 deletions
|
@ -28,7 +28,6 @@ clap = { workspace = true }
|
|||
countme = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
memchr = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
serde = { workspace = true, optional = true }
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
// "reStructuredText."
|
||||
#![allow(clippy::doc_markdown)]
|
||||
|
||||
use itertools::Itertools;
|
||||
use std::cmp::Ordering;
|
||||
use std::sync::LazyLock;
|
||||
use std::{borrow::Cow, collections::VecDeque};
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
use regex::Regex;
|
||||
use ruff_formatter::printer::SourceMapGeneration;
|
||||
use ruff_python_ast::{str::Quote, StringFlags};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use {once_cell::sync::Lazy, regex::Regex};
|
||||
use {
|
||||
ruff_formatter::{write, FormatOptions, IndentStyle, LineWidth, Printed},
|
||||
ruff_python_trivia::{is_python_whitespace, PythonWhitespace},
|
||||
|
@ -1075,7 +1075,7 @@ impl<'src> CodeExampleRst<'src> {
|
|||
// [directives]: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives
|
||||
// [Pygments lexer names]: https://pygments.org/docs/lexers/
|
||||
// [code-block]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-code-block
|
||||
static DIRECTIVE_START: Lazy<Regex> = Lazy::new(|| {
|
||||
static DIRECTIVE_START: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(
|
||||
r"(?m)^\s*\.\. \s*(?i:code-block|sourcecode)::\s*(?i:python|py|python3|py3)$",
|
||||
)
|
||||
|
@ -1320,7 +1320,7 @@ impl<'src> CodeExampleMarkdown<'src> {
|
|||
///
|
||||
/// [fenced code block]: https://spec.commonmark.org/0.30/#fenced-code-blocks
|
||||
fn new(original: InputDocstringLine<'src>) -> Option<CodeExampleMarkdown<'src>> {
|
||||
static FENCE_START: Lazy<Regex> = Lazy::new(|| {
|
||||
static FENCE_START: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(
|
||||
r"(?xm)
|
||||
^
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::LazyLock;
|
||||
use {
|
||||
itertools::Either::{Left, Right},
|
||||
once_cell::sync::Lazy,
|
||||
regex::Regex,
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,7 @@ impl Transformer for Normalizer {
|
|||
}
|
||||
|
||||
fn visit_string_literal(&self, string_literal: &mut ast::StringLiteral) {
|
||||
static STRIP_DOC_TESTS: Lazy<Regex> = Lazy::new(|| {
|
||||
static STRIP_DOC_TESTS: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(
|
||||
r"(?mx)
|
||||
(
|
||||
|
@ -75,14 +75,14 @@ impl Transformer for Normalizer {
|
|||
)
|
||||
.unwrap()
|
||||
});
|
||||
static STRIP_RST_BLOCKS: Lazy<Regex> = Lazy::new(|| {
|
||||
static STRIP_RST_BLOCKS: LazyLock<Regex> = LazyLock::new(|| {
|
||||
// This is kind of unfortunate, but it's pretty tricky (likely
|
||||
// impossible) to detect a reStructuredText block with a simple
|
||||
// regex. So we just look for the start of a block and remove
|
||||
// everything after it. Talk about a hammer.
|
||||
Regex::new(r"::(?s:.*)").unwrap()
|
||||
});
|
||||
static STRIP_MARKDOWN_BLOCKS: Lazy<Regex> = Lazy::new(|| {
|
||||
static STRIP_MARKDOWN_BLOCKS: LazyLock<Regex> = LazyLock::new(|| {
|
||||
// This covers more than valid Markdown blocks, but that's OK.
|
||||
Regex::new(r"(```|~~~)\p{any}*(```|~~~|$)").unwrap()
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue