mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-26 23:49:59 -07:00
Fix various clippy warnings
This commit fixes various clippy warnings that do not affect the function of the code and aren't stylistic in nature.
This commit is contained in:
committed by
Will Greenberg
parent
9c26e89b24
commit
d0d01089dd
@@ -97,11 +97,9 @@ impl AnalysisRow {
|
||||
|
||||
pub fn contains_warnings(&self) -> bool {
|
||||
for analysis in &self.analysis {
|
||||
for maybe_event in &analysis.events {
|
||||
if let Some(event) = maybe_event {
|
||||
if matches!(event.event_type, EventType::QualitativeWarning { .. }) {
|
||||
return true;
|
||||
}
|
||||
for event in analysis.events.iter().flatten() {
|
||||
if matches!(event.event_type, EventType::QualitativeWarning { .. }) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Analyzer for ConnectionRedirect2GDowngradeAnalyzer {
|
||||
match carrier_info {
|
||||
RedirectedCarrierInfo::Geran(_carrier_freqs_geran) => Some(Event {
|
||||
event_type: EventType::QualitativeWarning { severity: Severity::High },
|
||||
message: format!("Detected 2G downgrade"),
|
||||
message: "Detected 2G downgrade".to_owned(),
|
||||
}),
|
||||
_ => Some(Event {
|
||||
event_type: EventType::Informational,
|
||||
|
||||
@@ -50,7 +50,7 @@ impl Analyzer for ImsiRequestedAnalyzer {
|
||||
event_type: EventType::QualitativeWarning {
|
||||
severity: Severity::High
|
||||
},
|
||||
message: format!("NAS IMSI identity request detected"),
|
||||
message: "NAS IMSI identity request detected".to_owned(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,18 +29,18 @@ impl NullCipherAnalyzer {
|
||||
}
|
||||
// Use map/flatten to dig into a long chain of nested Option types
|
||||
let maybe_v1250 = c1.non_critical_extension.as_ref()
|
||||
.map(|v890| v890.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v920| v920.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v1020| v1020.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v1130| v1130.non_critical_extension.as_ref()).flatten();
|
||||
.and_then(|v890| v890.non_critical_extension.as_ref())
|
||||
.and_then(|v920| v920.non_critical_extension.as_ref())
|
||||
.and_then(|v1020| v1020.non_critical_extension.as_ref())
|
||||
.and_then(|v1130| v1130.non_critical_extension.as_ref());
|
||||
let Some(v1250) = maybe_v1250 else {
|
||||
return false;
|
||||
};
|
||||
|
||||
if let Some(SCG_Configuration_r12::Setup(scg_setup)) = v1250.scg_configuration_r12.as_ref() {
|
||||
let maybe_cipher = scg_setup.scg_config_part_scg_r12.as_ref()
|
||||
.map(|scg| scg.mobility_control_info_scg_r12.as_ref()).flatten()
|
||||
.map(|mci| mci.ciphering_algorithm_scg_r12.as_ref()).flatten();
|
||||
.and_then(|scg| scg.mobility_control_info_scg_r12.as_ref())
|
||||
.and_then(|mci| mci.ciphering_algorithm_scg_r12.as_ref());
|
||||
if let Some(cipher) = maybe_cipher {
|
||||
if cipher.0 == CipheringAlgorithm_r12::EEA0 {
|
||||
return true;
|
||||
@@ -49,10 +49,10 @@ impl NullCipherAnalyzer {
|
||||
}
|
||||
|
||||
let maybe_v1530_security_config = v1250.non_critical_extension.as_ref()
|
||||
.map(|v1310| v1310.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v1430| v1430.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v1510| v1510.non_critical_extension.as_ref()).flatten()
|
||||
.map(|v1530| v1530.security_config_ho_v1530.as_ref()).flatten();
|
||||
.and_then(|v1310| v1310.non_critical_extension.as_ref())
|
||||
.and_then(|v1430| v1430.non_critical_extension.as_ref())
|
||||
.and_then(|v1510| v1510.non_critical_extension.as_ref())
|
||||
.and_then(|v1530| v1530.security_config_ho_v1530.as_ref());
|
||||
let Some(v1530_security_config) = maybe_v1530_security_config else {
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user