Skip to content

Commit

Permalink
maintenance
Browse files Browse the repository at this point in the history
* stable rust for arm
* back to gnu for linux
* fix some clippy
  • Loading branch information
M4R7iNP committed Oct 27, 2023
1 parent eaae11a commit 2f7c85a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
13 changes: 1 addition & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,32 @@ jobs:
include:
- build: linux
os: ubuntu-latest
toolchain: stable
target: x86_64-unknown-linux-musl
target: x86_64-unknown-linux-gnu
binary_postfix: ""

- build: windows
os: windows-latest
toolchain: stable
target: x86_64-pc-windows-msvc
binary_postfix: ".exe"

- build: macos
os: macos-latest
toolchain: stable
target: x86_64-apple-darwin
binary_postfix: ""

- build: macos-arm-64
os: macos-latest
toolchain: nightly
target: aarch64-apple-darwin
binary_postfix: ""

steps:
- name: install musl-tools if musl target
if: ${{ contains(matrix.target, 'musl') }}
run: sudo apt install musl-tools

- uses: actions/checkout@v3
with:
submodules: recursive

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true

- name: Download cache
uses: actions/cache@v3
Expand Down
14 changes: 3 additions & 11 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ impl Backend {
let all_vmod_imports: Vec<VmodImport> = documents_from_main_in_order
.iter()
.flat_map(|doc_url| -> Vec<VmodImport> {
let mut cache_entry = self
.cache
.entry((*doc_url).clone())
.or_insert_with(CacheEntry::default);
let mut cache_entry = self.cache.entry((*doc_url).clone()).or_default();
cache_entry
.vmod_imports
.get_or_insert_with(|| {
Expand All @@ -122,10 +119,7 @@ impl Backend {
documents_from_main_in_order
.iter()
.flat_map(|doc_url| {
let mut cache_entry = self
.cache
.entry((*doc_url).clone())
.or_insert_with(CacheEntry::default);
let mut cache_entry = self.cache.entry((*doc_url).clone()).or_default();
cache_entry
.definitions
.get_or_insert_with(|| {
Expand Down Expand Up @@ -889,9 +883,7 @@ fn get_all_documents(
doc_uri: &Url,
) -> Vec<Url> {
let includes: Vec<Include> = {
let mut entry = cache
.entry(doc_uri.clone())
.or_insert_with(CacheEntry::default);
let mut entry = cache.entry(doc_uri.clone()).or_default();

entry
.includes
Expand Down
6 changes: 3 additions & 3 deletions src/safe_regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ mod tests {

#[test]
fn valid() {
let re = r#"^/nyheter/i/(\w+)"#.to_string();
let re = r"^/nyheter/i/(\w+)".to_string();
let result = is_regex_safe(re);
assert_eq!(result, Ok(true));
}

#[test]
fn invalid() {
let re = r#"{{{{{{{{["#.to_string();
let re = "{{{{{{{{[".to_string();
let result = is_regex_safe(re);
assert_eq!(result, Err(SafeRegexError::ParseError));
}

#[test]
fn exponential() {
let re = r#"(.*)*"#.to_string();
let re = "(.*)*".to_string();
let result = is_regex_safe(re);
assert_eq!(result, Err(SafeRegexError::StarHeightError));
}
Expand Down

0 comments on commit 2f7c85a

Please sign in to comment.