Skip to content

Commit

Permalink
allow -> expect in several places
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Sep 7, 2024
1 parent 53e7a81 commit 1d97137
Show file tree
Hide file tree
Showing 36 changed files with 54 additions and 56 deletions.
2 changes: 1 addition & 1 deletion driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ fn rustc_args<T: AsRef<OsStr>, U: AsRef<str>, V: AsRef<Path>>(
Ok(rustc_args)
}

#[allow(clippy::unwrap_used)]
#[expect(clippy::unwrap_used)]
#[cfg(test)]
mod test {
use super::*;
Expand Down
2 changes: 1 addition & 1 deletion examples/experimental/derive_opportunity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ declare_lint! {

impl_lint_pass!(DeriveOpportunity<'_> => [DERIVE_OPPORTUNITY]);

#[allow(clippy::no_mangle_with_rust_abi)]
#[expect(clippy::no_mangle_with_rust_abi)]
#[no_mangle]
pub fn register_lints(sess: &Session, lint_store: &mut LintStore) {
dylint_linting::init_config(sess);
Expand Down
2 changes: 1 addition & 1 deletion examples/experimental/derive_opportunity/ui/main.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
2 changes: 1 addition & 1 deletion examples/experimental/derive_opportunity/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
2 changes: 1 addition & 1 deletion examples/experimental/derive_opportunity/ui_ignore/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl MissingDocCommentOpenai {
impl<'tcx> LateLintPass<'tcx> for MissingDocCommentOpenai {
fn check_crate(&mut self, cx: &LateContext<'tcx>) {
if std::env::var(OPENAI_API_KEY).is_err() {
#[allow(clippy::disallowed_methods)]
#[expect(clippy::disallowed_methods)]
cx.sess().dcx().warn(format!(
"`missing_doc_comment_openai` suggestions are disabled because environment \
variable `{OPENAI_API_KEY}` is not set"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![expect(dead_code)]

use serde::{Deserialize, Serialize};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn main() {}

/// A doc comment generated by OpenAI.
// A comment.
#[allow(clippy::disallowed_names)]
#[expect(clippy::disallowed_names)]
pub fn foo() {}

/// Negative test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
fn main() {}

// A comment.
#[allow(clippy::disallowed_names)]
#[expect(clippy::disallowed_names)]
pub fn foo() {}

/// Negative test.
Expand Down
2 changes: 1 addition & 1 deletion examples/general/abs_home_path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn ui() {
if let Some(home) = home::home_dir()
&& !Path::new(env!("CARGO_MANIFEST_DIR")).starts_with(home)
{
#[allow(clippy::explicit_write)]
#[expect(clippy::explicit_write)]
writeln!(
stderr(),
"Skipping `ui` test as repository is not stored in the user's home directory"
Expand Down
4 changes: 2 additions & 2 deletions examples/general/await_holding_span_guard/ui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn bad_owned() {
bar().await;
}

#[allow(clippy::manual_async_fn)]
#[expect(clippy::manual_async_fn)]
fn bad_async_block_borrowed() -> impl std::future::Future<Output = ()> + 'static {
async move {
let span = span!(Level::INFO, "async_block_borrowed");
Expand All @@ -43,7 +43,7 @@ async fn baz(value: usize) {
let _ = value;
}

#[allow(unused_must_use)]
#[expect(unused_must_use)]
fn main() {
good_in_scope();
good_instrument();
Expand Down
4 changes: 2 additions & 2 deletions examples/general/crate_wide_allow/ui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ fn main() {
}

mod inner_attribute {
#![allow(clippy::bool_assert_comparison)]
#![allow(dead_code)]
#![expect(clippy::bool_assert_comparison)]
#![expect(dead_code)]
fn foo() {}
fn bar() {
assert_eq!("a".is_empty(), false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![expect(dead_code)]

use std::{
env::{var, VarError},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![expect(dead_code)]

use std::{
env::{var, VarError},
Expand Down
3 changes: 1 addition & 2 deletions examples/general/non_thread_safe_call_in_test/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ fn is_blacklisted_function(
path
}

#[cfg_attr(dylint_lib = "supplementary", allow(commented_code))]
#[cfg_attr(dylint_lib = "overscoped_allow", allow(overscoped_allow))]
#[cfg_attr(dylint_lib = "supplementary", expect(commented_code))]
fn command_new_additional_checks(cx: &LateContext<'_>, callee: &Expr, args: &[Expr]) -> bool {
if let [arg] = args
&& let ExprKind::Lit(lit) = arg.kind
Expand Down
2 changes: 1 addition & 1 deletion examples/general/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dylint_linting::dylint_library!();
extern crate rustc_lint;
extern crate rustc_session;

#[allow(clippy::no_mangle_with_rust_abi)]
#[expect(clippy::no_mangle_with_rust_abi)]
#[no_mangle]
pub fn register_lints(sess: &rustc_session::Session, lint_store: &mut rustc_lint::LintStore) {
// smoelius: Please keep the following `register_lints` calls sorted by crate name.
Expand Down
8 changes: 4 additions & 4 deletions examples/general/wrong_serialize_struct_arg/ui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod multiple_serialize_struct_calls {
field: u8,
}
impl Struct {
#[allow(dead_code)]
#[expect(dead_code)]
fn foo<S>(&self, first: S, second: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -112,7 +112,7 @@ mod nested_blocks {
field: u8,
}
impl Struct {
#[allow(dead_code)]
#[expect(dead_code)]
fn foo<S>(&self, outer: S, inner: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -137,7 +137,7 @@ mod serialize_field_with_no_preceding_serialize_struct {
field: u8,
}
impl Struct {
#[allow(dead_code)]
#[expect(dead_code)]
fn foo<S>(&self, mut state: S::SerializeStruct) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down Expand Up @@ -169,7 +169,7 @@ mod wrong_serialize_struct {
field: u8,
}
impl Struct {
#[allow(dead_code)]
#[expect(dead_code)]
// smoelius: Changing `T<S>` to `S` in the next line should cause a warning to be emitted.
fn foo<S>(&self, serializer: T<S>) -> Result<S::Ok, S::Error>
where
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
2 changes: 1 addition & 1 deletion examples/restriction/assert_eq_arg_misordering/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(dead_code)]
#![expect(dead_code)]

fn main() {}

Expand Down
4 changes: 2 additions & 2 deletions examples/restriction/collapsible_unwrap/ui/main.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fs;

const PATH: &str = "Cargo.toml";

#[allow(unused_variables)]
#[expect(unused_variables)]
fn main() {
assert!(std::path::Path::new(PATH)
.canonicalize()
Expand Down Expand Up @@ -54,7 +54,7 @@ fn main() {
println!("{:?}", name);
}

#[allow(dead_code)]
#[expect(dead_code)]
fn mut_test() {
let _ = fs::read_dir(".").ok().and_then(|mut read_dir| read_dir.next()).unwrap();
}
4 changes: 2 additions & 2 deletions examples/restriction/collapsible_unwrap/ui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fs;

const PATH: &str = "Cargo.toml";

#[allow(unused_variables)]
#[expect(unused_variables)]
fn main() {
assert!(std::path::Path::new(PATH)
.canonicalize()
Expand Down Expand Up @@ -71,7 +71,7 @@ fn main() {
println!("{:?}", name);
}

#[allow(dead_code)]
#[expect(dead_code)]
fn mut_test() {
let _ = fs::read_dir(".").unwrap().next().unwrap();
}
6 changes: 3 additions & 3 deletions examples/restriction/inconsistent_qualification/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![expect(dead_code)]

use std::env::var;

Expand Down Expand Up @@ -61,7 +61,7 @@ mod trait_import {
// is that the compiler is not returning the correct span for that path.
#[cfg_attr(
dylint_lib = "inconsistent_qualification",
allow(inconsistent_qualification)
expect(inconsistent_qualification)
)]
mod diesel {
use diesel::table;
Expand Down Expand Up @@ -100,7 +100,7 @@ mod trait_path {
}

mod relative_module_path {
#[allow(unused_imports)]
#[expect(unused_imports)]
use bar::baz;

fn foo() {
Expand Down
2 changes: 1 addition & 1 deletion examples/restriction/misleading_variable_name/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused)]
#![expect(unused)]

use anyhow::{Context, Result};
use std::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused)]
#![expect(unused)]

fn main() -> Result<(), ()> {
let mut x = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/supplementary/commented_code/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn check_captures(
return;
}

#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
span_lint_and_help(
cx,
COMMENTED_CODE,
Expand Down
2 changes: 1 addition & 1 deletion examples/supplementary/local_ref_cell/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused_variables)]
#![expect(unused_variables)]

use std::cell::RefCell;

Expand Down
2 changes: 1 addition & 1 deletion examples/supplementary/redundant_reference/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fn ui() {
);
}

#[cfg_attr(dylint_lib = "supplementary", allow(commented_code))]
#[cfg_attr(dylint_lib = "supplementary", expect(commented_code))]
#[test]
fn ui_no_lifetime_check() {
// smoelius: For some reason, the diagnostic messages are printed in a different order on Linux
Expand Down
2 changes: 1 addition & 1 deletion examples/supplementary/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dylint_linting::dylint_library!();
extern crate rustc_lint;
extern crate rustc_session;

#[allow(clippy::no_mangle_with_rust_abi)]
#[expect(clippy::no_mangle_with_rust_abi)]
#[no_mangle]
pub fn register_lints(sess: &rustc_session::Session, lint_store: &mut rustc_lint::LintStore) {
// smoelius: Please keep the following `register_lints` calls sorted by crate name.
Expand Down
2 changes: 1 addition & 1 deletion examples/supplementary/unnecessary_borrow_mut/ui/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused_assignments, unused_variables)]
#![expect(unused_assignments, unused_variables)]

use std::cell::RefCell;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::ty::{
};
use rustc_span::{symbol::sym, Symbol};

#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
pub fn check_inherents(cx: &LateContext<'_>) {
let into_iterator_def_id = get_trait_def_id(
cx.tcx,
Expand Down
Loading

0 comments on commit 1d97137

Please sign in to comment.