Skip to content

Commit

Permalink
Fix clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcrosta committed Jul 23, 2024
1 parent 574934b commit 5400938
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion detectors/avoid-core-mem-forget/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
extern crate rustc_ast;
extern crate rustc_span;

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_ast::{Expr, ExprKind, Item, NodeId};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_span::sym;
use clippy_utils::diagnostics::span_lint_and_help;

const LINT_MESSAGE: &str = "Use the `let _ = ...` pattern or `.drop()` method to forget the value";

Expand Down
2 changes: 1 addition & 1 deletion detectors/avoid-unsafe-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::diagnostics::span_lint;
use rustc_hir::{
def_id::LocalDefId,
intravisit::{walk_expr, FnKind, Visitor},
BlockCheckMode, Body, Expr, ExprKind, FnDecl, UnsafeSource,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::Span;
use clippy_utils::diagnostics::span_lint;

const LINT_MESSAGE: &str = "Avoid using unsafe blocks as it may lead to undefined behavior";

Expand Down
2 changes: 1 addition & 1 deletion detectors/divide-before-multiply/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern crate rustc_span;

use std::collections::HashSet;

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
intravisit::{walk_expr, FnKind, Visitor},
Expand All @@ -24,7 +25,6 @@ use rustc_span::{
def_id::{DefId, LocalDefId},
Span,
};
use clippy_utils::diagnostics::span_lint_and_help;

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

Expand Down
2 changes: 1 addition & 1 deletion detectors/incorrect-exponentiation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::diagnostics::span_lint_and_help;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::Visitor;
use rustc_hir::intravisit::{walk_expr, FnKind};
use rustc_hir::{Body, FnDecl};
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::Span;
use clippy_utils::diagnostics::span_lint_and_help;

const LINT_MESSAGE: &str = "'^' It is not an exponential operator. It is a bitwise XOR.";
const LINT_HELP: &str = "If you want to use XOR, use bitxor(). If you want to raise a number use .checked_pow() or .pow() ";
Expand Down
2 changes: 1 addition & 1 deletion detectors/insufficiently-random-values/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{BinOpKind, Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::Symbol;
use clippy_utils::diagnostics::span_lint_and_help;

const LINT_MESSAGE: &str = "Use env.prng() to generate random numbers, and remember that all random numbers are under the control of validators";

Expand Down
2 changes: 1 addition & 1 deletion detectors/iterators-over-indexing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern crate rustc_middle;
extern crate rustc_span;
extern crate rustc_type_ir;

use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::{Label, LitIntType, LitKind};
use rustc_hir::{
def::Res,
Expand All @@ -19,7 +20,6 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::{TyCtxt, TyKind};
use rustc_span::{symbol::Ident, Span};
use rustc_type_ir::Interner;
use clippy_utils::diagnostics::span_lint_and_help;
use utils::get_node_type;

const LINT_MESSAGE: &str =
Expand Down
2 changes: 1 addition & 1 deletion detectors/overflow-check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use std::{
str::from_utf8,
};

use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::Crate;
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_span::DUMMY_SP;
use clippy_utils::diagnostics::span_lint_and_help;
use toml::Value;

const LINT_MESSAGE: &str = "Use `overflow-checks = true` in Cargo.toml profile";
Expand Down
2 changes: 1 addition & 1 deletion detectors/set-contract-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern crate rustc_span;

use std::collections::{HashMap, HashSet};

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
intravisit::{walk_expr, FnKind, Visitor},
Expand All @@ -17,7 +18,6 @@ use rustc_span::{
def_id::{DefId, LocalDefId},
Span, Symbol,
};
use clippy_utils::diagnostics::span_lint_and_help;
use utils::FunctionCallVisitor;

const LINT_MESSAGE: &str = "Abitrary users should not have control over keys because it implies writing any value of left mapping, lazy variable, or the main struct of the contract located in position 0 of the storage";
Expand Down
2 changes: 1 addition & 1 deletion detectors/soroban-version/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ extern crate rustc_span;

use std::{io::Error, process::Command};

use clippy_utils::diagnostics::span_lint_and_help;
use rustc_ast::Crate;
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_span::DUMMY_SP;
use clippy_utils::diagnostics::span_lint_and_help;
use semver::Version;
use serde_json::Value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern crate rustc_span;

use std::collections::{HashMap, HashSet};

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
intravisit::{walk_expr, FnKind, Visitor},
Expand All @@ -18,7 +19,6 @@ use rustc_span::{
def_id::{DefId, LocalDefId},
Span, Symbol,
};
use clippy_utils::diagnostics::span_lint_and_help;
use utils::{is_soroban_address, is_soroban_env, is_soroban_function, FunctionCallVisitor};

const LINT_MESSAGE: &str = "This update_current_contract_wasm is called without access control";
Expand Down
2 changes: 1 addition & 1 deletion detectors/unused-return-enum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::diagnostics::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
intravisit::{walk_expr, FnKind, Visitor},
Body, Expr, ExprKind, FnDecl, FnRetTy, MatchSource, QPath, TyKind,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::{def_id::LocalDefId, sym, Span};
use clippy_utils::diagnostics::span_lint_and_help;

const LINT_MESSAGE : &str = "If any of the variants (Ok/Err) is not used, the code could be simplified or it could imply a bug";

Expand Down
2 changes: 1 addition & 1 deletion detectors/vec-could-be-mapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ extern crate rustc_middle;
extern crate rustc_span;
extern crate rustc_type_ir;

use clippy_utils::diagnostics::span_lint_and_help;
use rustc_hir::{
intravisit::{walk_expr, FnKind, Visitor},
Body, Expr, FnDecl, GenericArg, HirId, QPath, Stmt, TyKind,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty::GenericArgKind;
use rustc_span::{def_id::LocalDefId, Span};
use clippy_utils::diagnostics::span_lint_and_help;
use utils::{
definition_to_string, expr_to_method_call, expr_to_path, get_node_type, get_type_string,
path_to_resolved, resolution_to_local, stmt_to_local, type_to_adt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mod tests {
let client = AvoidPanicErrorClient::new(&env, &contract_id);

// When
let _max_value = client.try_add(&u32::max_value());
let _max_value = client.try_add(&u32::MAX);
let overflow = client.try_add(&1);

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod tests {
let client = AvoidPanicErrorClient::new(&env, &contract_id);

// When
client.add(&u32::max_value());
client.add(&u32::MAX);
client.add(&1);

// Then
Expand Down

0 comments on commit 5400938

Please sign in to comment.