This PR: * Added the clippy.toml to configure allowable expect / unwrap usage in tests * Removed as many expect/allow lines as possible from tests * moved a bunch of allows to expects where possible Note: in integration tests, non `#[test]` helper functions are not covered by this so we had to leave a few lingering `expect(expect_used` checks around
23 lines
742 B
Rust
23 lines
742 B
Rust
#![expect(clippy::expect_used)]
|
|
|
|
use regex_lite::Regex;
|
|
|
|
// This is defined in its own file so we can limit the scope of
|
|
// `allow(clippy::expect_used)` because we cannot scope it to the `lazy_static!`
|
|
// macro.
|
|
lazy_static::lazy_static! {
|
|
/// Regular expression that matches Codex-style source file citations such as:
|
|
///
|
|
/// ```text
|
|
/// 【F:src/main.rs†L10-L20】
|
|
/// ```
|
|
///
|
|
/// Capture groups:
|
|
/// 1. file path (anything except the dagger `†` symbol)
|
|
/// 2. start line number (digits)
|
|
/// 3. optional end line (digits or `?`)
|
|
pub(crate) static ref CITATION_REGEX: Regex = Regex::new(
|
|
r"【F:([^†]+)†L(\d+)(?:-L(\d+|\?))?】"
|
|
).expect("failed to compile citation regex");
|
|
}
|