Skip to content

Commit 930651e

Browse files
committed
Pin clippy_utils and dylint-linting
1 parent 781f9cf commit 930651e

File tree

71 files changed

+193
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+193
-328
lines changed

detectors/Cargo.toml

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
[workspace]
2-
members = ["*"]
32
exclude = [".cargo", "target"]
3+
members = ["*"]
44

55
[workspace.dependencies]
6-
dylint_testing = "3.0.0"
7-
if_chain = "1.0.2"
8-
9-
scout-audit-clippy-utils = { version = "=0.2.3" }
10-
scout-audit-internal = { version = "=0.2.3", features = ["detector", "lint_helper"] }
11-
dylint_linting = { package = "scout-audit-dylint-linting", version = "3.0.1" }
12-
itertools = { version = "0.12" }
6+
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "99c7838" }
7+
if_chain = "=1.0.2"
8+
itertools = { version = "=0.13" }
9+
scout-audit-dylint-linting = { git = "https://github.com/CoinFabrik/scout-audit", rev = "e03ede4" }

detectors/assert-violation/Cargo.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "assert-violation"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1713

1814
[package.metadata.rust-analyzer]
1915
rustc_private = true

detectors/assert-violation/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
extern crate rustc_ast;
44
extern crate rustc_span;
55

6+
use clippy_utils::sym;
67
use if_chain::if_chain;
78
use rustc_ast::{
89
ptr::P,
@@ -11,10 +12,9 @@ use rustc_ast::{
1112
};
1213
use rustc_lint::{EarlyContext, EarlyLintPass};
1314
use rustc_span::{sym, Span};
14-
use scout_audit_clippy_utils::sym;
1515

1616
const LINT_MESSAGE: &str = "Assert causes panic. Instead, return a proper error.";
17-
dylint_linting::impl_pre_expansion_lint! {
17+
scout_audit_dylint_linting::impl_pre_expansion_lint! {
1818
/// ### What it does
1919
/// Checks for `assert!` usage.
2020
/// ### Why is this bad?
@@ -119,7 +119,7 @@ fn check_macro_call(cx: &EarlyContext, span: Span, mac: &P<MacCall>) {
119119
.iter()
120120
.any(|sym| &mac.path == sym)
121121
{
122-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
122+
clippy_utils::diagnostics::span_lint_and_help(
123123
cx,
124124
ASSERT_VIOLATION,
125125
span,
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
[package]
2+
edition = "2021"
23
name = "avoid-autokey-upgradable"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
1312
itertools = { workspace = true }
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
13+
scout-audit-dylint-linting = { workspace = true }
1714

1815
[package.metadata.rust-analyzer]
1916
rustc_private = true

detectors/avoid-autokey-upgradable/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use rustc_hir::{
1414
};
1515
use rustc_lint::{LateContext, LateLintPass};
1616
use rustc_span::Span;
17-
use scout_audit_clippy_utils::diagnostics::span_lint_and_note;
17+
use clippy_utils::diagnostics::span_lint_and_note;
1818

19-
dylint_linting::impl_late_lint! {
19+
scout_audit_dylint_linting::impl_late_lint! {
2020
pub AVOID_AUTOKEY_UPGRADABLE,
2121
Warn,
2222
"",
+3-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "avoid-core-mem-forget"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1713

1814
[package.metadata.rust-analyzer]
1915
rustc_private = true

detectors/avoid-core-mem-forget/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_span::sym;
1111

1212
const LINT_MESSAGE: &str = "Using `core::mem::forget` is not recommended.";
1313

14-
dylint_linting::impl_pre_expansion_lint! {
14+
scout_audit_dylint_linting::impl_pre_expansion_lint! {
1515
/// ### What it does
1616
/// Checks for `core::mem::forget` usage.
1717
/// ### Why is this bad?
@@ -79,7 +79,7 @@ impl EarlyLintPass for AvoidStdCoreMemForget {
7979
if path.segments[1].ident.name.to_string() == "mem";
8080
if path.segments[2].ident.name.to_string() == "forget";
8181
then {
82-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
82+
clippy_utils::diagnostics::span_lint_and_help(
8383
cx,
8484
AVOID_STD_CORE_MEM_FORGET,
8585
expr.span,
+3-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "avoid-format-string"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1713

1814
[package.metadata.rust-analyzer]
1915
rustc_private = true

detectors/avoid-format-string/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use rustc_ast::{
1111
};
1212
use rustc_lint::{EarlyContext, EarlyLintPass};
1313
use rustc_span::{sym, Span};
14-
use scout_audit_clippy_utils::sym;
14+
use clippy_utils::sym;
1515

1616
const LINT_MESSAGE: &str = "The format! macro should not be used.";
1717

18-
dylint_linting::impl_pre_expansion_lint! {
18+
scout_audit_dylint_linting::impl_pre_expansion_lint! {
1919
/// ### What it does
2020
/// Detects the usage of `format!` macro.
2121
///
@@ -93,7 +93,7 @@ impl EarlyLintPass for AvoidFormatString {
9393
if mac.path == sym!(format);
9494

9595
then {
96-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
96+
clippy_utils::diagnostics::span_lint_and_help(
9797
cx,
9898
AVOID_FORMAT_STRING,
9999
expr.span,
+3-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "avoid-unsafe-block"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
[dev-dependencies]
15-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1613

1714
[package.metadata.rust-analyzer]
1815
rustc_private = true

detectors/avoid-unsafe-block/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ extern crate rustc_span;
55

66
use rustc_ast::{BlockCheckMode, Expr, ExprKind, UnsafeSource};
77
use rustc_lint::{EarlyContext, EarlyLintPass};
8-
use scout_audit_clippy_utils::diagnostics::span_lint;
8+
use clippy_utils::diagnostics::span_lint;
99

1010
const LINT_MESSAGE: &str = "Avoid using unsafe blocks as it may lead to undefined behavior.";
11-
dylint_linting::impl_pre_expansion_lint! {
11+
scout_audit_dylint_linting::impl_pre_expansion_lint! {
1212
pub AVOID_UNSAFE_BLOCK,
1313
Warn,
1414
LINT_MESSAGE,
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "buffering-unsized-types"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
[dev-dependencies]
15-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1613

1714
[package.metadata.rust-analyzer]
1815
rustc_private = true

detectors/buffering-unsized-types/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use rustc_hir::{
1212
use rustc_lint::{LateContext, LateLintPass};
1313
use rustc_span::symbol::Ident;
1414
use rustc_span::Span;
15-
use scout_audit_clippy_utils::diagnostics::span_lint_and_help;
15+
use clippy_utils::diagnostics::span_lint_and_help;
1616
const LINT_MESSAGE: &str = "Do not use these method with an unsized (dynamically sized) type.";
17-
dylint_linting::impl_late_lint! {
17+
scout_audit_dylint_linting::impl_late_lint! {
1818
pub BUFFERING_UNSIZED_TYPES,
1919
Warn,
2020
LINT_MESSAGE,

detectors/delegate-call/Cargo.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "delegate-call"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1713

1814
[package.metadata.rust-analyzer]
1915
rustc_private = true

detectors/delegate-call/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_span::Span;
1616

1717
const LINT_MESSAGE: &str = "Passing arguments to the target of a delegate call is not safe, as it allows the caller to set a malicious hash as the target.";
1818

19-
dylint_linting::declare_late_lint! {
19+
scout_audit_dylint_linting::declare_late_lint! {
2020
/// ### What it does
2121
/// Checks for delegated calls to contracts passed as arguments.
2222
/// ### Why is this bad?
@@ -149,7 +149,7 @@ impl<'tcx> LateLintPass<'tcx> for DelegateCall {
149149
walk_expr(&mut delegate_storage, body.value);
150150

151151
if delegate_storage.has_vulnerable_delegate {
152-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
152+
clippy_utils::diagnostics::span_lint_and_help(
153153
cx,
154154
DELEGATE_CALL,
155155
delegate_storage.span.unwrap(),
+3-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
[package]
2+
edition = "2021"
23
name = "divide-before-multiply"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
dylint_linting = { workspace = true }
1110
if_chain = { workspace = true }
11+
scout-audit-dylint-linting = { workspace = true }
1212

13-
scout-audit-clippy-utils = { workspace = true }
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
13+
clippy_utils = { workspace = true }
1714

1815
[package.metadata.rust-analyzer]
1916
rustc_private = true

detectors/divide-before-multiply/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rustc_span::Span;
2424

2525
const LINT_MESSAGE: &str = "Division before multiplication might result in a loss of precision";
2626

27-
dylint_linting::declare_late_lint! {
27+
scout_audit_dylint_linting::declare_late_lint! {
2828
/// ### What it does
2929
/// Checks the existence of a division before a multiplication.
3030
///
@@ -365,7 +365,7 @@ impl<'tcx> LateLintPass<'tcx> for DivideBeforeMultiply {
365365
);
366366

367367
for span in spans {
368-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
368+
clippy_utils::diagnostics::span_lint_and_help(
369369
cx,
370370
DIVIDE_BEFORE_MULTIPLY,
371371
span,
@@ -382,7 +382,7 @@ impl<'tcx> LateLintPass<'tcx> for DivideBeforeMultiply {
382382
if BinOpKind::Mul == op.node;
383383
then{
384384
for division in get_divisions_inside_expr(expr) {
385-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
385+
clippy_utils::diagnostics::span_lint_and_help(
386386
cx,
387387
DIVIDE_BEFORE_MULTIPLY,
388388
division,
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
[package]
2+
edition = "2021"
23
name = "dont-use-instantiate-contract-v1"
34
version = "0.1.0"
4-
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
scout-audit-clippy-utils = { workspace = true }
11-
dylint_linting = { workspace = true }
10+
clippy_utils = { workspace = true }
1211
if_chain = { workspace = true }
13-
14-
15-
[dev-dependencies]
16-
dylint_testing = { workspace = true }
12+
scout-audit-dylint-linting = { workspace = true }
1713

1814
[package.metadata.rust-analyzer]
1915
rustc_private = true

detectors/dont-use-instantiate-contract-v1/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_span::{Span, Symbol};
1414
const LINT_MESSAGE: &str =
1515
"This is a low level way to instantiate another smart contract, calling the legacy `instantiate_v1` host function.";
1616

17-
dylint_linting::declare_late_lint! {
17+
scout_audit_dylint_linting::declare_late_lint! {
1818
pub DONT_USE_INSTANTIATE_CONTRACT_V1,
1919
Warn,
2020
LINT_MESSAGE,
@@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for DontUseInstantiateContractV1 {
6060

6161
visitor.has_instantiate_contract_v1_span.iter().for_each(|span| {
6262
if let Some(span) = span {
63-
scout_audit_clippy_utils::diagnostics::span_lint_and_help(
63+
clippy_utils::diagnostics::span_lint_and_help(
6464
cx,
6565
DONT_USE_INSTANTIATE_CONTRACT_V1,
6666
*span,

0 commit comments

Comments
 (0)