-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix /some/ new clippy warnings #757
Conversation
Example: error: deref which would be done by auto-deref --> x11rb/src/rust_connection/stream.rs:168:35 | 168 | return self.write(&**buf, fds); | ^^^^^^ help: try this: `buf` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref Signed-off-by: Uli Schlachter <psychon@znc.in>
Example warning: error: the borrowed expression implements the required traits --> x11rb/examples/integration_test_util/util.rs:41:83 | 41 | if let Err(err) = conn.send_event(false, window, EventMask::NO_EVENT, &event) { | ^^^^^^ help: change this to: `event` | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Signed-off-by: Uli Schlachter <psychon@znc.in>
error: deref which would be done by auto-deref --> x11rb/tests/parsing_tests.rs:86:47 | 86 | let (setup, remaining) = Setup::try_parse(&*setup)?; | ^^^^^^^ help: try this: `&setup` | = note: `-D clippy::explicit-auto-deref` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref Signed-off-by: Uli Schlachter <psychon@znc.in>
error: deref which would be done by auto-deref --> x11rb/src/utils.rs:76:13 | 76 | &**self | ^^^^^^^ help: try this: `self` | = note: `-D clippy::explicit-auto-deref` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref Signed-off-by: Uli Schlachter <psychon@znc.in>
Codecov ReportBase: 13.54% // Head: 13.54% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #757 +/- ##
=======================================
Coverage 13.54% 13.54%
=======================================
Files 141 141
Lines 119917 119909 -8
=======================================
+ Hits 16240 16243 +3
+ Misses 103677 103666 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Example: error: deref which would be done by auto-deref --> generator/src/generator/namespace/mod.rs:1468:29 | 1468 | ... &*case.fields.borrow(), | ^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&case.fields.borrow()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref Signed-off-by: Uli Schlachter <psychon@znc.in>
error: the borrowed expression implements the required traits --> x11rb/src/cursor/find_cursor.rs:262:36 | 262 | theme_dir.push(&home); | ^^^^^ help: change this to: `home` | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow error: this `to_owned` call clones the std::borrow::Cow<[u8]> itself and does not cause the std::borrow::Cow<[u8]> contents to become owned --> x11rb/src/image.rs:525:19 | 525 | data: self.data.to_owned(), | ^^^^^^^^^^^^^^^^^^^^ help: consider using, depending on intent: `self.data.clone()` or `self.data.into_owned()` | = note: `-D clippy::suspicious-to-owned` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_to_owned error: deref which would be done by auto-deref --> x11rb-protocol/src/resource_manager/parser.rs:298:38 | 298 | let result = parse_query(*data); | ^^^^^ help: try this: `data` | = note: `-D clippy::explicit-auto-deref` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref error: deref which would be done by auto-deref --> x11rb-protocol/src/resource_manager/parser.rs:313:38 | 313 | let result = parse_query(*data); | ^^^^^ help: try this: `data` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref error: deref which would be done by auto-deref --> x11rb-protocol/src/resource_manager/parser.rs:561:31 | 561 | match parse_entry(*data) { | ^^^^^ help: try this: `data` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref Signed-off-by: Uli Schlachter <psychon@znc.in>
ToOwned is automatically implemented for everything that implements Clone and our hand-written implementation of ToOwned does nothing else than we would get from this blanket implementation. Thus, let the compiler simply derive this. Signed-off-by: Uli Schlachter <psychon@znc.in>
error: boolean to int conversion using if --> x11rb/src/xcb_ffi/mod.rs:206:21 | 206 | isvoid: if has_reply { 0 } else { 1 }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(!has_reply)` | = note: `-D clippy::bool-to-int-with-if` implied by `-D warnings` = note: `!has_reply as u8` or `(!has_reply).into()` can also be valid options = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if Signed-off-by: Uli Schlachter <psychon@znc.in>
error: the borrowed expression implements the required traits --> x11rb/tests/resource_manager.rs:42:32 | 42 | fs::create_dir_all(&parent).unwrap(); | ^^^^^^^ help: change this to: `parent` | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Signed-off-by: Uli Schlachter <psychon@znc.in>
This PR now adds something more than just "mechanically apply clippy suggestions": 71fd6c7 makes
Oh, hey, a blanket implementation! Let's just use that. (Note: This is actually a behaviour change because previously |
once_cell v1.15 switched to the 2021 edition and thus requires at least Rust 1.56 to build. This commit increases our MSRV accordingly. Fixes: #756 Signed-off-by: Uli Schlachter <psychon@znc.in>
....aaaand this now also bumps the MSRV to 1.56 to fix #756 |
I am not quite sure why these only showed up after the MSRV was increased, but whatever... Example: error: the borrowed expression implements the required traits --> x11rb/src/wrapper.rs:50:28 | 50 | data_u8.extend(&item.to_ne_bytes()); | ^^^^^^^^^^^^^^^^^^^ help: change this to: `item.to_ne_bytes()` | = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Signed-off-by: Uli Schlachter <psychon@znc.in>
@notgull Could you approve this? |
Thanks! I'll now take a look at the |
Okay, enough CI ping-pong for today. This is as far as I want to go for now. Good night.