-
Notifications
You must be signed in to change notification settings - Fork 190
Replace once_cell:: to std::sync::* #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| static REPLACE_WILDCARDS: Lazy<Regex> = Lazy::new(|| Regex::new(r##"\*"##).unwrap()); | ||
| static TRAILING_SEPARATOR: Lazy<Regex> = Lazy::new(|| Regex::new(r##"\^$"##).unwrap()); | ||
| static SPECIAL_CHARS: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r##"([.+?^${}()|\[\]\\])"##).unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
| static SPECIAL_CHARS: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r##"([.+?^${}()|\[\]\\])"##).unwrap()); | ||
| static REPLACE_WILDCARDS: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r##"\*"##).unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
| static REPLACE_WILDCARDS: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r##"\*"##).unwrap()); | ||
| static TRAILING_SEPARATOR: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r##"\^$"##).unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
| Lazy::new(|| Regex::new(r"^[#.]?[A-Za-z_][\w-]*$").unwrap()); | ||
| use std::sync::LazyLock; | ||
| static RE_SIMPLE_SELECTOR: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new(r"^[#.]?[A-Za-z_][\w-]*$").unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
| // TODO - this could be made more efficient if we could match between two | ||
| // indices. Once again, we have to do more work than is really needed. | ||
| static SEPARATOR: Lazy<Regex> = Lazy::new(|| Regex::new("[/^*]").unwrap()); | ||
| static SEPARATOR: LazyLock<Regex> = LazyLock::new(|| Regex::new("[/^*]").unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
| static INVALID_CHARS: Lazy<Regex> = | ||
| Lazy::new(|| Regex::new("[/^*!?$&(){}\\[\\]+=~`\\s|@,'\"><:;]").unwrap()); | ||
| static INVALID_CHARS: LazyLock<Regex> = | ||
| LazyLock::new(|| Regex::new("[/^*!?$&(){}\\[\\]+=~`\\s|@,'\"><:;]").unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reported by reviewdog 🐶
[opengrep] expect or unwrap called in function returning a Result
Source: https://semgrep.dev/r/trailofbits.rs.panic-in-function-returning-result.panic-in-function-returning-result
Cc @thypon @kdenhartog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust Benchmark
Details
| Benchmark suite | Current: 762cf51 | Previous: 501a190 | Ratio |
|---|---|---|---|
rule-match-browserlike/brave-list |
2056135382 ns/iter (± 9214731) |
2018520591 ns/iter (± 4934304) |
1.02 |
rule-match-first-request/brave-list |
1118974 ns/iter (± 5158) |
1096986 ns/iter (± 15575) |
1.02 |
blocker_new/brave-list |
134715590 ns/iter (± 1333941) |
131745302 ns/iter (± 313177) |
1.02 |
blocker_new/brave-list-deserialize |
23556301 ns/iter (± 328054) |
22889579 ns/iter (± 85767) |
1.03 |
memory-usage/brave-list-initial |
10213344 ns/iter (± 3) |
10213344 ns/iter (± 3) |
1 |
memory-usage/brave-list-initial/max |
60612235 ns/iter (± 3) |
60612235 ns/iter (± 3) |
1 |
memory-usage/brave-list-initial/alloc-count |
996170 ns/iter (± 3) |
996170 ns/iter (± 3) |
1 |
memory-usage/brave-list-1000-requests |
2282164 ns/iter (± 3) |
2282164 ns/iter (± 3) |
1 |
memory-usage/brave-list-1000-requests/alloc-count |
69311 ns/iter (± 3) |
69311 ns/iter (± 3) |
1 |
url_cosmetic_resources/brave-list |
194226 ns/iter (± 1344) |
201294 ns/iter (± 495) |
0.96 |
cosmetic-class-id-match/brave-list |
3332694 ns/iter (± 924296) |
3395590 ns/iter (± 898195) |
0.98 |
This comment was automatically generated by workflow using github-action-benchmark.
|
Can we remove unwraps in non-test code? |
@kdenhartog this PR does straight forward API replacing without adding or removing |
The PR replaces usages of
once_cellcrate to the standardstd::sync::primitives