Skip to content

Commit

Permalink
fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jwong101 committed Nov 6, 2024
1 parent 708bd5b commit 1283a93
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions crates/forge_analyzer/src/checkers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl<'cx> Runner<'cx> for AuthZChecker {
}
}

impl<'cx> Checker<'cx> for AuthZChecker {
impl Checker<'_> for AuthZChecker {
type Vuln = AuthZVuln;
}

Expand Down Expand Up @@ -664,7 +664,7 @@ impl<'cx> Runner<'cx> for AuthenticateChecker {
}
}

impl<'cx> Checker<'cx> for AuthenticateChecker {
impl Checker<'_> for AuthenticateChecker {
type Vuln = AuthNVuln;
}

Expand Down Expand Up @@ -980,7 +980,7 @@ impl<'cx> Runner<'cx> for SecretChecker {
}
}

impl<'cx> Checker<'cx> for SecretChecker {
impl Checker<'_> for SecretChecker {
type Vuln = SecretVuln;
}

Expand Down Expand Up @@ -1299,7 +1299,7 @@ impl<'cx> Runner<'cx> for PermissionChecker {
}
}

impl<'cx> Checker<'cx> for PermissionChecker {
impl Checker<'_> for PermissionChecker {
type Vuln = PermissionVuln;
}

Expand Down
9 changes: 4 additions & 5 deletions crates/forge_analyzer/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ fn normalize_callee_expr(
in_prop: bool,
}

impl<'cx> CalleeNormalizer<'cx> {
impl CalleeNormalizer<'_> {
fn check_prop(&mut self, n: &MemberProp) {
let old_prop = mem::replace(&mut self.in_prop, true);
n.visit_with(self);
Expand Down Expand Up @@ -972,7 +972,7 @@ fn classify_api_call(expr: &Expr) -> ApiCallKind {
classifier.kind
}

impl<'cx> FunctionAnalyzer<'cx> {
impl FunctionAnalyzer<'_> {
#[inline]
fn set_curr_terminator(&mut self, term: Terminator) {
self.body.set_terminator(self.block, term);
Expand Down Expand Up @@ -1031,15 +1031,14 @@ impl<'cx> FunctionAnalyzer<'cx> {

[PropPath::Def(def), PropPath::Static(ref s), ..] if is_storage_read(s) => {
match self.res.is_imported_from(def, "@forge/api") {
Some(&ImportKind::Named(ref name)) if *name == *"storage" => {
Some(ImportKind::Named(name)) if *name == *"storage" => {
Some(Intrinsic::StorageRead)
}
_ => None,
}
}
[PropPath::Def(def), ..] if self.res.is_imported_from(def, "@forge/api").is_some() => {
if let Some(&ImportKind::Named(ref name)) =
self.res.is_imported_from(def, "@forge/api")
if let Some(ImportKind::Named(name)) = self.res.is_imported_from(def, "@forge/api")
{
if *name == *"authorize" {
return Some(Intrinsic::Authorize(IntrinsicName::Other));
Expand Down
4 changes: 3 additions & 1 deletion crates/forge_analyzer/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ impl Body {
}

#[inline]
pub(crate) fn iter_cfg_enumerated(&self) -> impl IntoIterator<Item = (u32, u32)> + 'static + use<> {
pub(crate) fn iter_cfg_enumerated(
&self,
) -> impl IntoIterator<Item = (u32, u32)> + 'static + use<> {
self.build_cfg_vec()
}

Expand Down
4 changes: 2 additions & 2 deletions crates/forge_analyzer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ pub fn return_combinations_phi(exprs: Vec<Value>) -> Value {
combinations = new_combinations;
}

return Value::Phi(
Value::Phi(
combinations
.iter()
.map(|value| Const::Literal(value.clone()))
.collect_vec(),
);
)
}

pub fn eq_prop_name(n: &MemberProp, name: &str) -> bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ pub fn get_permisions_for(
endpoint_map_classic: &mut PermissionHashMap,
endpoint_regex: &mut HashMap<String, Regex>,
) {
#[allow(if_let_rescope)]
if let Result::Ok(response) = ureq::get(url).call() {
let data: SwaggerReponse = response.into_json().unwrap();
for (key, endpoint_data) in &data.paths {
Expand Down
2 changes: 1 addition & 1 deletion crates/fsrt/src/forge_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub(crate) struct ForgeProjectFromDir {
pub manifest_file_content: String,
}

impl<'a> ForgeProjectTrait<'a> for ForgeProjectFromDir {
impl ForgeProjectTrait<'_> for ForgeProjectFromDir {
fn load_file(&self, path: impl AsRef<Path>, sourcemap: Arc<SourceMap>) -> Arc<SourceFile> {
sourcemap.load_file(path.as_ref()).unwrap()
}
Expand Down

0 comments on commit 1283a93

Please sign in to comment.