Skip to content

Commit 1b4d41a

Browse files
committed
chore: Replace once_cell dependency by std lib
LazyLock is introduced in rust 1.80
1 parent 409b932 commit 1b4d41a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
env:
1212
PROTOC_VERSION: '3.20.3'
13-
clippy_rust_version: '1.79'
13+
clippy_rust_version: '1.80'
1414

1515
jobs:
1616
# Depends on all actions that are required for a "successful" CI run.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ authors = [
2626
]
2727
license = "Apache-2.0"
2828
repository = "https://github.com/tokio-rs/prost"
29-
rust-version = "1.70"
29+
rust-version = "1.80"
3030
edition = "2021"
3131

3232
[profile.bench]

prost-build/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ petgraph = { version = "0.6", default-features = false }
2424
prost = { version = "0.13.1", path = "../prost", default-features = false }
2525
prost-types = { version = "0.13.1", path = "../prost-types", default-features = false }
2626
tempfile = "3"
27-
once_cell = "1.17.1"
2827
regex = { version = "1.8.1", default-features = false, features = ["std", "unicode-bool"] }
2928

3029
# feature: format

prost-build/src/ast.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use once_cell::sync::Lazy;
21
use prost_types::source_code_info::Location;
32
#[cfg(feature = "cleanup-markdown")]
43
use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
54
use regex::Regex;
5+
use std::sync::LazyLock;
66

77
/// Comments on a Protobuf item.
88
#[derive(Debug, Default, Clone)]
@@ -110,9 +110,10 @@ impl Comments {
110110
/// - escape urls as <http://foo.com>
111111
/// - escape `[` & `]` if not already escaped and not followed by a parenthesis or bracket
112112
fn sanitize_line(line: &str) -> String {
113-
static RULE_URL: Lazy<Regex> = Lazy::new(|| Regex::new(r"https?://[^\s)]+").unwrap());
114-
static RULE_BRACKETS: Lazy<Regex> =
115-
Lazy::new(|| Regex::new(r"(^|[^\]\\])\[(([^\]]*[^\\])?)\]([^(\[]|$)").unwrap());
113+
static RULE_URL: LazyLock<Regex> =
114+
LazyLock::new(|| Regex::new(r"https?://[^\s)]+").unwrap());
115+
static RULE_BRACKETS: LazyLock<Regex> =
116+
LazyLock::new(|| Regex::new(r"(^|[^\]\\])\[(([^\]]*[^\\])?)\]([^(\[]|$)").unwrap());
116117

117118
let mut s = RULE_URL.replace_all(line, r"<$0>").to_string();
118119
s = RULE_BRACKETS.replace_all(&s, r"$1\[$2\]$4").to_string();

0 commit comments

Comments
 (0)