mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
This resolves every single error raised by [Clippy](https://github.com/rust-lang/rust-clippy) for every active crate. Most are formatting or redundant code, there's only a few things that are functionally better. * Implement PartialEq manually on Prefab and Pop to ensure consistency with Hash * Disable clippy::if_same_then_else for simple elif chains * Add a standard path for the unit test codebase so I don't have to worry about git add * Collapse nested if within smart cables loop * mem::replace(x, X::default()) -> mem::take(x) * Single character strings -> chars * Use a const fn for Constant::null, unwrap_or -> unwrap_or_else calls to it * writeln! always uses \n alone * Address complex type signatures with type aliases * PickArgs shouldn't have Box in it's type alias * Random unnecessary variable access * Add and remove closures where appropriate * No more redundant field names in struct initialization * Remove unnecessary references * Use strip_prefix instead of starts_with -> [..] * Use Range.contains instead of >= && <= comparisons * Group hex literals by 4 * Elide lifetimes wherever possible * Replace match with matches! wherever possible * Remove needless borrows * Control flow cleanup * Misc signature & redundancy fixes * Rename functions or move them to the correct std Trait * Just ignore the too many arguments lint on the big ugly functions * require! wasn't doing anything in tree_block. tree_entries returns a Status<()>, thus passing () to self.require. Macro expansion: ```rust fn tree_block( &mut self, current: NodeIndex, proc_kind: Option<ProcDeclKind>, var_type: Option<VarTypeBuilder>, ) -> Status<()> { match self.exact(Token::Punct(Punctuation::LBrace))? { Some(x) => x, None => return Ok(None), }; Ok(Some({ let v = self.tree_entries( current, proc_kind, var_type, Token::Punct(Punctuation::RBrace), ); self.require(v)? })) } fn tree_entries( &mut self, current: NodeIndex, proc_kind: Option<ProcDeclKind>, var_type: Option<VarTypeBuilder>, terminator: Token, ) -> Status<()> { ``` * Fix large enum variants Co-authored-by: Tad Hardesty <tad@platymuus.com> * Clarify intent on some of the linted code
3 lines
32 B
Text
3 lines
32 B
Text
target/
|
|
.vscode/
|
|
test_codebase/
|