forked from StrafesNET/maps-service
validation: clippy fixes
This commit is contained in:
@@ -152,7 +152,7 @@ pub struct ModelInfo<'a>{
|
|||||||
|
|
||||||
pub fn get_model_info<'a>(dom:&'a rbx_dom_weak::WeakDom,model_instance:&'a rbx_dom_weak::Instance)->ModelInfo<'a>{
|
pub fn get_model_info<'a>(dom:&'a rbx_dom_weak::WeakDom,model_instance:&'a rbx_dom_weak::Instance)->ModelInfo<'a>{
|
||||||
// extract model info
|
// extract model info
|
||||||
let map_info=get_mapinfo(&dom,model_instance);
|
let map_info=get_mapinfo(dom,model_instance);
|
||||||
|
|
||||||
// count objects (default count is 0)
|
// count objects (default count is 0)
|
||||||
let mut counts=Counts::default();
|
let mut counts=Counts::default();
|
||||||
@@ -206,7 +206,7 @@ impl<'a,Str> StringCheckContext<'a,Str>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'a,Str:std::fmt::Display> std::fmt::Display for StringCheckContext<'a,Str>{
|
impl<Str:std::fmt::Display> std::fmt::Display for StringCheckContext<'_,Str>{
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||||
write!(f,"expected: {}, observed: {}",self.expected,self.observed)
|
write!(f,"expected: {}, observed: {}",self.expected,self.observed)
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ impl<ID,T> SetDifferenceCheckContextAllowNone<ID,T>{
|
|||||||
impl<ID:Eq+std::hash::Hash,T> SetDifferenceCheckContextAllowNone<ID,T>{
|
impl<ID:Eq+std::hash::Hash,T> SetDifferenceCheckContextAllowNone<ID,T>{
|
||||||
fn check<U>(mut self,reference_set:&HashMap<ID,U>)->SetDifferenceCheck<Self>{
|
fn check<U>(mut self,reference_set:&HashMap<ID,U>)->SetDifferenceCheck<Self>{
|
||||||
// remove correct entries
|
// remove correct entries
|
||||||
for (id,_) in reference_set{
|
for id in reference_set.keys(){
|
||||||
self.extra.remove(id);
|
self.extra.remove(id);
|
||||||
}
|
}
|
||||||
// if any entries remain, they are incorrect
|
// if any entries remain, they are incorrect
|
||||||
@@ -281,7 +281,7 @@ impl<ID,T> SetDifferenceCheckContextAtLeastOne<ID,T>{
|
|||||||
impl<ID:Copy+Eq+std::hash::Hash,T> SetDifferenceCheckContextAtLeastOne<ID,T>{
|
impl<ID:Copy+Eq+std::hash::Hash,T> SetDifferenceCheckContextAtLeastOne<ID,T>{
|
||||||
fn check<U>(mut self,reference_set:&HashMap<ID,U>)->SetDifferenceCheck<Self>{
|
fn check<U>(mut self,reference_set:&HashMap<ID,U>)->SetDifferenceCheck<Self>{
|
||||||
// remove correct entries
|
// remove correct entries
|
||||||
for (id,_) in reference_set{
|
for id in reference_set.keys(){
|
||||||
if self.extra.remove(id).is_none(){
|
if self.extra.remove(id).is_none(){
|
||||||
// the set did not contain a required item. This is a fail
|
// the set did not contain a required item. This is a fail
|
||||||
self.missing.insert(*id);
|
self.missing.insert(*id);
|
||||||
@@ -370,14 +370,14 @@ impl<'a> ModelInfo<'a>{
|
|||||||
let game_id=self.map_info.game_id;
|
let game_id=self.map_info.game_id;
|
||||||
|
|
||||||
// MapStart must exist
|
// MapStart must exist
|
||||||
let mapstart=if self.counts.mode_start_counts.get(&ModeID::MAIN).is_some(){
|
let mapstart=if self.counts.mode_start_counts.contains_key(&ModeID::MAIN){
|
||||||
Ok(())
|
Ok(())
|
||||||
}else{
|
}else{
|
||||||
Err(())
|
Err(())
|
||||||
};
|
};
|
||||||
|
|
||||||
// Spawn1 must exist
|
// Spawn1 must exist
|
||||||
let spawn1=if self.counts.spawn_counts.get(&SpawnID::FIRST).is_some(){
|
let spawn1=if self.counts.spawn_counts.contains_key(&SpawnID::FIRST){
|
||||||
Ok(())
|
Ok(())
|
||||||
}else{
|
}else{
|
||||||
Err(())
|
Err(())
|
||||||
@@ -431,7 +431,7 @@ impl<'a> ModelInfo<'a>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MapCheck<'a>{
|
impl MapCheck<'_>{
|
||||||
fn pass(self)->Result<MapInfoOwned,Self>{
|
fn pass(self)->Result<MapInfoOwned,Self>{
|
||||||
match self{
|
match self{
|
||||||
MapCheck{
|
MapCheck{
|
||||||
@@ -485,7 +485,7 @@ macro_rules! write_zone{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
impl<'a> std::fmt::Display for MapCheck<'a>{
|
impl std::fmt::Display for MapCheck<'_>{
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||||
if let StringCheck(Err(context))=&self.model_class{
|
if let StringCheck(Err(context))=&self.model_class{
|
||||||
writeln!(f,"Invalid model class: {context}")?;
|
writeln!(f,"Invalid model class: {context}")?;
|
||||||
@@ -521,7 +521,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write!(f," ({} duplicates)",names.len())?;
|
write!(f," ({} duplicates)",names.len())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
if let SetDifferenceCheck(Err(context))=&self.mode_finish_counts{
|
if let SetDifferenceCheck(Err(context))=&self.mode_finish_counts{
|
||||||
if !context.extra.is_empty(){
|
if !context.extra.is_empty(){
|
||||||
@@ -530,7 +530,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)|
|
write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)|
|
||||||
write_zone!(f,mode_id,"Finish")
|
write_zone!(f,mode_id,"Finish")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
if !context.missing.is_empty(){
|
if !context.missing.is_empty(){
|
||||||
let plural=if context.missing.len()==1{"zone"}else{"zones"};
|
let plural=if context.missing.len()==1{"zone"}else{"zones"};
|
||||||
@@ -538,7 +538,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.missing.iter(),|f,mode_id|
|
write_comma_separated(f,context.missing.iter(),|f,mode_id|
|
||||||
write_zone!(f,mode_id,"Finish")
|
write_zone!(f,mode_id,"Finish")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let SetDifferenceCheck(Err(context))=&self.mode_anticheat_counts{
|
if let SetDifferenceCheck(Err(context))=&self.mode_anticheat_counts{
|
||||||
@@ -548,20 +548,20 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)|
|
write_comma_separated(f,context.extra.iter(),|f,(mode_id,_names)|
|
||||||
write_zone!(f,mode_id,"Anticheat")
|
write_zone!(f,mode_id,"Anticheat")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Err(())=&self.spawn1{
|
if let Err(())=&self.spawn1{
|
||||||
writeln!(f,"Model has no Spawn1")?;
|
writeln!(f,"Model has no Spawn1")?;
|
||||||
}
|
}
|
||||||
if let SetDifferenceCheck(Err(context))=&self.teleport_counts{
|
if let SetDifferenceCheck(Err(context))=&self.teleport_counts{
|
||||||
for (_,names) in &context.extra{
|
for names in context.extra.values(){
|
||||||
let plural=if names.len()==1{"object"}else{"objects"};
|
let plural=if names.len()==1{"object"}else{"objects"};
|
||||||
write!(f,"No matching Spawn for {plural}: ")?;
|
write!(f,"No matching Spawn for {plural}: ")?;
|
||||||
write_comma_separated(f,names.iter(),|f,&name|{
|
write_comma_separated(f,names.iter(),|f,&name|{
|
||||||
write!(f,"{name}")
|
write!(f,"{name}")
|
||||||
})?;
|
})?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.spawn_counts{
|
if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.spawn_counts{
|
||||||
@@ -569,7 +569,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.iter(),|f,(SpawnID(spawn_id),count)|
|
write_comma_separated(f,context.iter(),|f,(SpawnID(spawn_id),count)|
|
||||||
write!(f,"Spawn{spawn_id} ({count} duplicates)")
|
write!(f,"Spawn{spawn_id} ({count} duplicates)")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
if let SetDifferenceCheck(Err(context))=&self.wormhole_in_counts{
|
if let SetDifferenceCheck(Err(context))=&self.wormhole_in_counts{
|
||||||
if !context.extra.is_empty(){
|
if !context.extra.is_empty(){
|
||||||
@@ -577,7 +577,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.extra.iter(),|f,(WormholeID(wormhole_id),_count)|
|
write_comma_separated(f,context.extra.iter(),|f,(WormholeID(wormhole_id),_count)|
|
||||||
write!(f,"WormholeIn{wormhole_id}")
|
write!(f,"WormholeIn{wormhole_id}")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
if !context.missing.is_empty(){
|
if !context.missing.is_empty(){
|
||||||
// This counts WormholeIn objects, but
|
// This counts WormholeIn objects, but
|
||||||
@@ -586,7 +586,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.missing.iter(),|f,WormholeID(wormhole_id)|
|
write_comma_separated(f,context.missing.iter(),|f,WormholeID(wormhole_id)|
|
||||||
write!(f,"WormholeOut{wormhole_id}")
|
write!(f,"WormholeOut{wormhole_id}")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.wormhole_out_counts{
|
if let DuplicateCheck(Err(DuplicateCheckContext(context)))=&self.wormhole_out_counts{
|
||||||
@@ -594,7 +594,7 @@ impl<'a> std::fmt::Display for MapCheck<'a>{
|
|||||||
write_comma_separated(f,context.iter(),|f,(WormholeID(wormhole_id),count)|
|
write_comma_separated(f,context.iter(),|f,(WormholeID(wormhole_id),count)|
|
||||||
write!(f,"WormholeOut{wormhole_id} ({count} duplicates)")
|
write!(f,"WormholeOut{wormhole_id} ({count} duplicates)")
|
||||||
)?;
|
)?;
|
||||||
writeln!(f,"")?;
|
writeln!(f)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ async fn main()->Result<(),StartupError>{
|
|||||||
"None"=>None,
|
"None"=>None,
|
||||||
_=>Some(s.parse().expect("ROBLOX_GROUP_ID int parse")),
|
_=>Some(s.parse().expect("ROBLOX_GROUP_ID int parse")),
|
||||||
},
|
},
|
||||||
Err(e)=>Err(e).expect("ROBLOX_GROUP_ID env required"),
|
Err(e)=>panic!("{e}: ROBLOX_GROUP_ID env required"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// create / upload models through STRAFESNET_CI2 account
|
// create / upload models through STRAFESNET_CI2 account
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub fn class_is_a(class:&str,superclass:&str)->bool{
|
|||||||
let class_descriptor=rbx_reflection_database::get().classes.get(class);
|
let class_descriptor=rbx_reflection_database::get().classes.get(class);
|
||||||
if let Some(descriptor)=&class_descriptor{
|
if let Some(descriptor)=&class_descriptor{
|
||||||
if let Some(class_super)=&descriptor.superclass{
|
if let Some(class_super)=&descriptor.superclass{
|
||||||
return class_is_a(&class_super,superclass)
|
return class_is_a(class_super,superclass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
@@ -71,7 +71,7 @@ impl std::str::FromStr for GameID{
|
|||||||
if s.starts_with("flytrials_"){
|
if s.starts_with("flytrials_"){
|
||||||
return Ok(GameID::FlyTrials);
|
return Ok(GameID::FlyTrials);
|
||||||
}
|
}
|
||||||
return Err(ParseGameIDError);
|
Err(ParseGameIDError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub struct GameIDError;
|
pub struct GameIDError;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ struct NamePolicy{
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn source_has_illegal_keywords(source:&str)->bool{
|
fn source_has_illegal_keywords(source:&str)->bool{
|
||||||
source.find("getfenv").is_some()||source.find("require").is_some()
|
source.contains("getfenv")||source.contains("require")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash_source(source:&str)->String{
|
fn hash_source(source:&str)->String{
|
||||||
|
|||||||
Reference in New Issue
Block a user