Skip to content
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

Fix errors from more recent clippy #110

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validation-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@beta
with:
components: clippy
- uses: Swatinem/rust-cache@v2
Expand Down
1 change: 1 addition & 0 deletions zspell-cli/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
.write(true)
.read(true)
.create(true)
.truncate(true)

Check warning on line 116 in zspell-cli/src/download.rs

View check run for this annotation

Codecov / codecov/patch

zspell-cli/src/download.rs#L116

Added line #L116 was not covered by tests
.open(path)
.context(format!("unable to open '{fname}' in '{dir}'"))
} else {
Expand Down
1 change: 1 addition & 0 deletions zspell/benches/datastructure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! might use in our spellchecker

#![allow(clippy::disallowed_types)]
#![allow(clippy::incompatible_msrv)]

use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fs::File;
Expand Down
2 changes: 2 additions & 0 deletions zspell/benches/dict_integration.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::incompatible_msrv)]

use std::fs;
use std::hint::black_box;

Expand Down
2 changes: 2 additions & 0 deletions zspell/benches/slice_contains.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Benchmark the difference between contains & `binary_search`es, intended

#![allow(clippy::incompatible_msrv)]

use std::hint::black_box;

use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
1 change: 1 addition & 0 deletions zspell/benches/small_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//! situ (should only affect compile times)

#![allow(clippy::disallowed_types)]
#![allow(clippy::incompatible_msrv)]

use std::collections::{BTreeMap, HashMap};
use std::hint::black_box;
Expand Down
2 changes: 2 additions & 0 deletions zspell/benches/word_splitter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::incompatible_msrv)]

use std::hint::black_box;

use criterion::{criterion_group, criterion_main, Criterion};
Expand Down
1 change: 1 addition & 0 deletions zspell/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ fn emit_autocfg() {

// check if we have `Box<[T]>: From<&[T: Clone]>` loosened from `T: Copy` (1.71)
ac.emit_expression_cfg(PROBE_BOX, "box_from_slice_has_clone_bound");
println!("cargo:rustc-check-cfg=cfg(box_from_slice_has_clone_bound)");
}
2 changes: 1 addition & 1 deletion zspell/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl Dictionary {
let mut nosuggest = false;

for flag in flags {
if self.affix_flags.get(flag).is_none() {
if !self.affix_flags.contains_key(flag) {
// FIXME: we get stuck on compound rules
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion zspell/src/dict/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum Source {
/// The full rule that created this
rule: Arc<AfxRule>,
/// Index of the relevant pattern within the rule. This could potentially be a reference
/// but that might require a RefCell, and I don't want to risk reference
/// but that might require a `RefCell`, and I don't want to risk reference
pat_idx: usize,
},
/// This meta came from a .dic file, only contains morphinfo
Expand Down
4 changes: 3 additions & 1 deletion zspell/src/dict/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ impl AfxRule {
ret.patterns.push(AfxRulePattern {
affix: rule.affix.as_str().into(),
condition: rule.condition.clone(),
strip: rule.strip.as_ref().map(Arc::clone),
// FIXME: `rule.strip.as_ref().map(Arc::clone)` is more accurate, but flagged by
// clippy
strip: rule.strip.clone(),
morph_info,
});
}
Expand Down
2 changes: 2 additions & 0 deletions zspell/test-util/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Utilities intended to help with test collection

#![forbid(unsafe_code)]
#![allow(clippy::assigning_clones)]

use std::collections::BTreeMap;
use std::fmt::Write;
Expand Down
Loading