-
Notifications
You must be signed in to change notification settings - Fork 278
Fixed some of the remaining clippy
warnings that needed slightly more complex refactors.
#462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…l` warning by applying the automatic fix and boolean reduction.
…hain into a `match` with `_ if`s. Also able to avoid some `.is_some()`s so the `match` is exhaustive.
…esize` and factoring out common logic from both `match` arms.
I also eliminated a `.clone()` this way and made the `.pop()` logic explicit.
There are also 2 remaining
c2rust/analysis/runtime/src/handlers.rs Lines 15 to 21 in 2113c3e
warning: `ptr` already exists, having another argument having almost the same name makes code comprehension and documentation more difficult
--> analysis/runtime/src/handlers.rs:15:32
|
15 | pub fn free(mir_loc: MirLocId, ptr: usize, _ptr: ()) {
| ^^^
|
= note: `#[warn(clippy::duplicate_underscore_argument)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#duplicate_underscore_argument @rinon, do you know why there are 2
c2rust/c2rust-transpile/src/translator/mod.rs Lines 2374 to 2388 in 2113c3e
error: this `if` has identical blocks
--> c2rust-transpile/src/translator/mod.rs:2377:51
|
2377 | } else if is_global && !is_inline {
| ___________________________________________________^
2378 | | mk_linkage(false, new_name, name).extern_("C").pub_()
2379 | | } else if is_inline && is_extern && !attrs.contains(&c_ast::Attribute::GnuInline) {
| |_________________^
|
= note: `#[deny(clippy::if_same_then_else)]` on by default
note: same as this
--> c2rust-transpile/src/translator/mod.rs:2379:99
|
2379 | } else if is_inline && is_extern && !attrs.contains(&c_ast::Attribute::GnuInline) {
| ___________________________________________________________________________________________________^
2380 | | // c99 extern inline functions should be pub, but not gnu_inline attributed
2381 | | // extern inlines, which become subject to their gnu89 visibility (private)
2382 | |
2383 | | mk_linkage(false, new_name, name).extern_("C").pub_()
2384 | | } else if self.cur_file.borrow().is_some() {
| |_________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else @rinon, do you know if these two branches are meant to be identical, and if so, can they just be merged into one? I wasn't sure if they were supposed to remain separate, especially with a comment that's different in one branch. |
…it with the main `fn unparen`.
…if`, `else` with a `#[allow(clippy::needless_bool)]` because it's more idiomatic Rust.
…s suggestion.
I fixed some of the remaining
clippy
warnings (from #460) that needed slightly more complex refactors, which I want to have reviewed to make sure they're semantics-preserving.