Skip to content

Commit

Permalink
Move overscoped_allow to experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Dec 27, 2024
1 parent 6752e8d commit b6dc252
Show file tree
Hide file tree
Showing 23 changed files with 1,735 additions and 115 deletions.
1 change: 0 additions & 1 deletion cargo-dylint/tests/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ fn sort() {

// smoelius: `supply_chain` is the only test that uses `supply_chain.json`. So there is no race.
#[cfg_attr(dylint_lib = "general", allow(non_thread_safe_call_in_test))]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
#[test]
fn supply_chain() {
let mut command = process::Command::new("cargo");
Expand Down
1 change: 0 additions & 1 deletion dylint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static REQUIRED_FORM: Lazy<String> = Lazy::new(|| {
});

#[cfg_attr(dylint_lib = "general", allow(non_local_effect_before_error_return))]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
pub fn run(opts: &opts::Dylint) -> Result<()> {
let opts = {
let opts_orig = opts;
Expand Down
1 change: 0 additions & 1 deletion dylint/src/library_packages/cargo_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ fn cargo_metadata(path: &Path) -> Result<Metadata> {
// smoelius: `ident` is based on the function of the same name at:
// https://github.com/rust-lang/cargo/blob/1a498b6c1c119a79d677553862bffae96b97ad7f/src/cargo/sources/git/source.rs#L136-L147
#[allow(clippy::manual_next_back)]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
fn ident(url: &str) -> Result<String> {
let url = Url::parse(url)?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
dylint_lib = "inconsistent_qualification",
allow(inconsistent_qualification)
)]
#![cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]

use anyhow::Result as CargoResult;

Expand Down
1 change: 0 additions & 1 deletion dylint/src/library_packages/cargo_cli/util/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#![allow(deprecated)]
#![allow(clippy::module_name_repetitions)]
#![cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
#![cfg_attr(dylint_lib = "supplementary", allow(unnamed_constant))]

type StableHasher = std::hash::SipHasher;
Expand Down
1 change: 0 additions & 1 deletion dylint/src/library_packages/cargo_lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ fn git_dependency_root(gctx: &GlobalContext, dep: &Dependency) -> Result<PathBuf
}

#[cfg_attr(dylint_lib = "general", allow(non_local_effect_before_error_return))]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
fn sample_package_id(dep: &Dependency, source: &mut dyn Source) -> Result<PackageId> {
let mut package_id: Option<PackageId> = None;

Expand Down
1 change: 0 additions & 1 deletion dylint/src/library_packages/cargo_lib/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
dylint_lib = "misleading_variable_name",
allow(misleading_variable_name)
)]
#![cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]

// smoelius: `ManifestContext::new` does not appear in the original.
#[allow(clippy::too_many_arguments)]
Expand Down
1 change: 0 additions & 1 deletion dylint/src/package_options/revs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl Iterator for RevIter<'_> {
// here. If `self.commit` were not updated, the same commits would be traversed the next time
// `next` was called.
#[cfg_attr(dylint_lib = "general", allow(non_local_effect_before_error_return))]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
fn next(&mut self) -> Option<Self::Item> {
(|| -> Result<Option<Rev>> {
let mut prev_rev: Option<Rev> = None;
Expand Down
10 changes: 5 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ The example libraries are separated into the following three categories:
| [`env_literal`](./restriction/env_literal) | Environment variables referred to with string literals |
| [`inconsistent_qualification`](./restriction/inconsistent_qualification) | Inconsistent qualification of module items |
| [`misleading_variable_name`](./restriction/misleading_variable_name) | Variables whose names suggest they have types other than the ones they have |
| [`overscoped_allow`](./restriction/overscoped_allow) | `allow` attributes whose scope could be reduced |
| [`question_mark_in_expression`](./restriction/question_mark_in_expression) | The `?` operator in expressions |
| [`ref_aware_redundant_closure_for_method_calls`](./restriction/ref_aware_redundant_closure_for_method_calls) | A ref-aware fork of `redundant_closure_for_method_calls` |
| [`register_lints_warn`](./restriction/register_lints_warn) | Calls to `rustc_errors::DiagCtxtHandle::warn` from within a `register_lints` function |
Expand All @@ -53,10 +52,11 @@ The example libraries are separated into the following three categories:

## Experimental

| Example | Description/check |
| ------------------------------------------------------------------------- | ---------------------------------------------- |
| [`derive_opportunity`](./experimental/derive_opportunity) | Traits that could be derived |
| [`missing_doc_comment_openai`](./experimental/missing_doc_comment_openai) | A lint that suggests doc comments using OpenAI |
| Example | Description/check |
| ------------------------------------------------------------------------- | ----------------------------------------------- |
| [`derive_opportunity`](./experimental/derive_opportunity) | Traits that could be derived |
| [`missing_doc_comment_openai`](./experimental/missing_doc_comment_openai) | A lint that suggests doc comments using OpenAI |
| [`overscoped_allow`](./experimental/overscoped_allow) | `allow` attributes whose scope could be reduced |

## Testing

Expand Down
5 changes: 5 additions & 0 deletions examples/experimental/overscoped_allow/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
target-dir = "../../../target/examples"

[target.'cfg(all())']
linker = "dylint-link"
Loading

0 comments on commit b6dc252

Please sign in to comment.