Skip to content

Commit

Permalink
deny and lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrafn Orri Hrafnkelsson committed Dec 9, 2024
1 parent d611cc6 commit 24766f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
multiple-versions = "deny"

[licenses]
allow = ["Apache-2.0", "MIT", "Unicode-DFS-2016"]
allow = ["Apache-2.0", "MIT", "Unicode-3.0"]
8 changes: 8 additions & 0 deletions tests/slow_function_warning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fn default_warning_compiles() {

#[test]
fn warn() {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {*warned = true;})]
pub fn sleep(millis: u64, warned: &mut bool) {
thread::sleep(Duration::from_millis(millis));
Expand All @@ -36,6 +37,7 @@ fn warn() {

#[test]
fn no_warn() {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {*warned = true;})]
pub fn sleep(millis: u64, warned: &mut bool) {
thread::sleep(Duration::from_millis(millis));
Expand All @@ -49,6 +51,7 @@ fn no_warn() {

#[test]
fn warn_using_params() {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {
println!("{module}::{function} {param}");
*warned = true;
Expand All @@ -65,6 +68,7 @@ fn warn_using_params() {

#[test]
fn no_warn_using_params() {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {
println!("{module}::{function} {param}");
*warned = true;
Expand All @@ -86,6 +90,7 @@ fn warn_impl() {
}

impl MyStruct {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {
println!("{module}::{function} {param}");
self.warned = true;
Expand All @@ -108,6 +113,7 @@ fn no_warn_impl() {
}

impl MyStruct {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {
println!("{module}::{function} {param}");
self.warned = true;
Expand All @@ -125,6 +131,7 @@ fn no_warn_impl() {

#[tokio::test]
async fn warn_async() {
#[allow(unused_variables)]
#[slow_function_warning(10ms, {
println!("{module}::{function} {param}");
*warned = true;
Expand All @@ -141,6 +148,7 @@ async fn warn_async() {

#[tokio::test]
async fn no_warn_async() {
#[allow(unused_variables)]
#[slow_function_warning(50ms, {
println!("{module}::{function} {param}");
*warned = true;
Expand Down

0 comments on commit 24766f7

Please sign in to comment.