Skip to content

Commit

Permalink
Passed through cargo fmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
Víctor M. González committed Jul 31, 2024
1 parent 8327e06 commit 51f7420
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion detectors/avoid-autokey-upgradable/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extern crate rustc_error_messages;
extern crate rustc_hir;
extern crate rustc_span;

use clippy_wrappers::span_lint_and_note;
use itertools::Itertools;
use rustc_error_messages::MultiSpan;
use rustc_hir::GenericArg;
Expand All @@ -14,7 +15,6 @@ use rustc_hir::{
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::Span;
use clippy_wrappers::span_lint_and_note;

scout_audit_dylint_linting::impl_late_lint! {
pub AVOID_AUTOKEY_UPGRADABLE,
Expand Down
2 changes: 1 addition & 1 deletion detectors/avoid-format-string/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
extern crate rustc_ast;
extern crate rustc_span;

use clippy_utils::sym;
use if_chain::if_chain;
use rustc_ast::{
tokenstream::{TokenStream, TokenTree},
AttrArgs, AttrKind, Expr, ExprKind, Item,
};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_span::{sym, Span};
use clippy_utils::sym;

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

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,9 +3,9 @@
extern crate rustc_ast;
extern crate rustc_span;

use clippy_wrappers::span_lint;
use rustc_ast::{BlockCheckMode, Expr, ExprKind, UnsafeSource};
use rustc_lint::{EarlyContext, EarlyLintPass};
use clippy_wrappers::span_lint;

const LINT_MESSAGE: &str = "Avoid using unsafe blocks as it may lead to undefined behavior.";
scout_audit_dylint_linting::impl_pre_expansion_lint! {
Expand Down
2 changes: 1 addition & 1 deletion detectors/buffering-unsized-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ extern crate rustc_hir;
extern crate rustc_span;
use std::collections::HashMap;

use clippy_wrappers::span_lint_and_help;
use rustc_hir::{
intravisit::{walk_expr, Visitor},
Expr, ExprKind, GenericArg, QPath, Ty, TyKind,
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::symbol::Ident;
use rustc_span::Span;
use clippy_wrappers::span_lint_and_help;
const LINT_MESSAGE: &str = "Do not use these method with an unsized (dynamically sized) type.";
scout_audit_dylint_linting::impl_late_lint! {
pub BUFFERING_UNSIZED_TYPES,
Expand Down
7 changes: 1 addition & 6 deletions detectors/dos-unexpected-revert-with-vector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,7 @@ impl<'tcx> LateLintPass<'tcx> for UnexpectedRevertWarn {
&mut HashSet::<BasicBlock>::default(),
);
for place in unchecked_places {
clippy_wrappers::span_lint(
cx,
UNEXPECTED_REVERT_WARN,
place.1,
LINT_MESSAGE,
);
clippy_wrappers::span_lint(cx, UNEXPECTED_REVERT_WARN, place.1, LINT_MESSAGE);
}
}

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_wrappers::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_wrappers::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
4 changes: 2 additions & 2 deletions detectors/integer-overflow-or-underflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::consts::constant_simple;
use clippy_utils::is_integer_literal;
use rustc_hir::{self as hir, Body, Expr, ExprKind, UnOp};
use rustc_lint::LateContext;
use rustc_lint::LateLintPass;
use rustc_span::Span;
use clippy_utils::consts::constant_simple;
use clippy_utils::is_integer_literal;

pub const LINT_MESSAGE: &str = "Potential for integer arithmetic overflow/underflow. Consider checked, wrapping or saturating arithmetic.";

Expand Down
9 changes: 2 additions & 7 deletions detectors/lazy-values-not-set/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern crate rustc_span;

use std::collections::HashMap;

use clippy_utils::match_def_path;
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{walk_expr, FnKind, Visitor};
use rustc_hir::{Body, FnDecl};
Expand All @@ -17,7 +18,6 @@ use rustc_middle::mir::{Local, Operand, Rvalue, TerminatorKind};
use rustc_middle::ty::TyKind;
use rustc_span::def_id::LocalDefId;
use rustc_span::Span;
use clippy_utils::match_def_path;

const LINT_MESSAGE: &str = "Lazy value was gotten here but never set afterwards";

Expand Down Expand Up @@ -120,12 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for LazyValuesNotSet {

let (_, hm) = self.get_func_info(cx, id.to_def_id(), &[], &[], &mut vec![]);
for val in hm.values() {
clippy_wrappers::span_lint(
cx,
LAZY_VALUES_NOT_SET,
*val,
LINT_MESSAGE,
);
clippy_wrappers::span_lint(cx, LAZY_VALUES_NOT_SET, *val, LINT_MESSAGE);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion detectors/non-payable-transferred-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#![feature(let_chains)]
extern crate rustc_ast;
extern crate rustc_span;
use clippy_wrappers::span_lint_and_help;
use rustc_ast::{
tokenstream::{TokenStream, TokenTree},
visit::{walk_block, walk_expr, Visitor},
AssocItem, AssocItemKind, AttrArgs, AttrKind, Attribute, DelimArgs, ExprKind, MethodCall,
};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_span::Span;
use clippy_wrappers::span_lint_and_help;

const LINT_MESSAGE: &str =
"Using `transferred_value` without #[ink(payable)] will always return 0.";
Expand Down
2 changes: 1 addition & 1 deletion detectors/panic-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
extern crate rustc_ast;
extern crate rustc_span;

use clippy_utils::sym;
use if_chain::if_chain;
use rustc_ast::{
ptr::P,
Expand All @@ -13,7 +14,6 @@ use rustc_ast::{
};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_span::{sym, Span};
use clippy_utils::sym;

const LINT_MESSAGE: &str = "The panic! macro is used to stop execution when a condition is not met. This is useful for testing and prototyping, but should be avoided in production code";

Expand Down
4 changes: 2 additions & 2 deletions detectors/unsafe-expect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ extern crate rustc_span;

use std::{collections::HashSet, hash::Hash};

use clippy_utils::higher;
use clippy_wrappers::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
def::Res,
Expand All @@ -15,8 +17,6 @@ use rustc_hir::{
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::{sym, Span, Symbol};
use clippy_utils::higher;
use clippy_wrappers::span_lint_and_help;

const LINT_MESSAGE: &str = "Unsafe usage of `expect`";
const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"];
Expand Down
4 changes: 2 additions & 2 deletions detectors/unsafe-unwrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ extern crate rustc_span;

use std::{collections::HashSet, hash::Hash};

use clippy_utils::higher;
use clippy_wrappers::span_lint_and_help;
use if_chain::if_chain;
use rustc_hir::{
def::Res,
Expand All @@ -15,8 +17,6 @@ use rustc_hir::{
};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::{sym, Span, Symbol};
use clippy_utils::higher;
use clippy_wrappers::span_lint_and_help;

const LINT_MESSAGE: &str = "Unsafe usage of `unwrap`";
const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"];
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 @@ -8,14 +8,14 @@ extern crate rustc_span;

use std::collections::HashMap;

use clippy_wrappers::span_lint_and_help;
use itertools::Itertools;
use rustc_hir::intravisit::{walk_expr, FnKind, Visitor};
use rustc_hir::{Body, Expr, ExprKind, FnDecl, GenericArg, GenericArgs, PathSegment, QPath};
use rustc_hir::{Ty, TyKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::def_id::LocalDefId;
use rustc_span::Span;
use clippy_wrappers::span_lint_and_help;

const LINT_MESSAGE: &str =
"You are iterating over a vector of tuples using `find`. Consider using a mapping instead.";
Expand Down
2 changes: 1 addition & 1 deletion detectors/warning-sr25519-verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ extern crate rustc_ast;
extern crate rustc_hir;
extern crate rustc_span;

use clippy_wrappers::span_lint_and_help;
use rustc_hir::{
intravisit::{walk_body, walk_expr, Visitor},
Expr, ExprKind, QPath,
};
use rustc_lint::LateLintPass;
use rustc_span::Span;
use clippy_wrappers::span_lint_and_help;

const LINT_MESSAGE: &str = "This function is from the unstable interface, which is unsafe and normally is not available on production chains.";

Expand Down

0 comments on commit 51f7420

Please sign in to comment.