diff --git a/Cargo.toml b/Cargo.toml index eb75a8dba..064fb0461 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ authors = [ ] license = "Apache-2.0" repository = "https://github.com/tokio-rs/prost" -rust-version = "1.71.1" +rust-version = "1.80" edition = "2021" [profile.bench] diff --git a/prost-build/Cargo.toml b/prost-build/Cargo.toml index 08331b5ef..c8f20dfa8 100644 --- a/prost-build/Cargo.toml +++ b/prost-build/Cargo.toml @@ -24,7 +24,6 @@ petgraph = { version = "0.6", default-features = false } prost = { version = "0.13.2", path = "../prost", default-features = false } prost-types = { version = "0.13.2", path = "../prost-types", default-features = false } tempfile = "3" -once_cell = "1.17.1" regex = { version = "1.8.1", default-features = false, features = ["std", "unicode-bool"] } # feature: format diff --git a/prost-build/src/ast.rs b/prost-build/src/ast.rs index 9a6a0de99..07c6394ad 100644 --- a/prost-build/src/ast.rs +++ b/prost-build/src/ast.rs @@ -1,8 +1,8 @@ -use once_cell::sync::Lazy; use prost_types::source_code_info::Location; #[cfg(feature = "cleanup-markdown")] use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag}; use regex::Regex; +use std::sync::LazyLock; /// Comments on a Protobuf item. #[derive(Debug, Default, Clone)] @@ -110,9 +110,10 @@ impl Comments { /// - escape urls as /// - escape `[` & `]` if not already escaped and not followed by a parenthesis or bracket fn sanitize_line(line: &str) -> String { - static RULE_URL: Lazy = Lazy::new(|| Regex::new(r"https?://[^\s)]+").unwrap()); - static RULE_BRACKETS: Lazy = - Lazy::new(|| Regex::new(r"(^|[^\]\\])\[(([^\]]*[^\\])?)\]([^(\[]|$)").unwrap()); + static RULE_URL: LazyLock = + LazyLock::new(|| Regex::new(r"https?://[^\s)]+").unwrap()); + static RULE_BRACKETS: LazyLock = + LazyLock::new(|| Regex::new(r"(^|[^\]\\])\[(([^\]]*[^\\])?)\]([^(\[]|$)").unwrap()); let mut s = RULE_URL.replace_all(line, r"<$0>").to_string(); s = RULE_BRACKETS.replace_all(&s, r"$1\[$2\]$4").to_string();