Commit 0179bf3b79

0179bf3b7981b27b6baf6c1745006ac630ef0cc9

parent: 618b603707

Unregistered key

Austin Ray <austin@austinray.io> · 2021-04-04 22:16 UTC

fix: remove #[used] from non-static fields

Rust 1.51 has a regression restricting the `#[used]` attribute[0] to
static fields. As such, it's not possible to build `weechat-matrix-rs`
on stable or nightly Rust. According to the `#[used]` RFC[1], the
attribute is for static variables so it's unclear if the new behavior is
the correct one.

However, to prevent clippy from complaining during CI, replace with
`#[allow(dead_code)]`

[0] https://github.com/rust-lang/rust/issues/82668
[1] https://rust-lang.github.io/rfcs/2386-used.html

Layout: unified · split

src/bar_items/mod.rs +3 −3
@@ -10,11 +10,11 @@ use buffer_plugin::BufferPlugin;
10use status::Status; 10use status::Status;
11 11
12pub struct BarItems { 12pub struct BarItems {
13 #[used] 13 #[allow(dead_code)]
14 status: BarItem, 14 status: BarItem,
15 #[used] 15 #[allow(dead_code)]
16 buffer_name: BarItem, 16 buffer_name: BarItem,
17 #[used] 17 #[allow(dead_code)]
18 buffer_plugin: BarItem, 18 buffer_plugin: BarItem,
19} 19}
20 20
src/completions.rs +1 −1
@@ -11,7 +11,7 @@ use weechat::{
11use crate::Servers; 11use crate::Servers;
12 12
13pub struct Completions { 13pub struct Completions {
14 #[used] 14 #[allow(dead_code)]
15 servers: CompletionHook, 15 servers: CompletionHook,
16} 16}
17 17
src/lib.rs +4 −5
@@ -150,15 +150,14 @@ impl SignalCallback for Servers {
150 150
151struct Matrix { 151struct Matrix {
152 servers: Servers, 152 servers: Servers,
153 #[used] 153 #[allow(dead_code)]
154 commands: Commands, 154 commands: Commands,
155 #[used]
156 config: ConfigHandle, 155 config: ConfigHandle,
157 #[used] 156 #[allow(dead_code)]
158 bar_items: BarItems, 157 bar_items: BarItems,
159 #[used] 158 #[allow(dead_code)]
160 typing_notice_signal: SignalHook, 159 typing_notice_signal: SignalHook,
161 #[used] 160 #[allow(dead_code)]
162 completions: Completions, 161 completions: Completions,
163 debug_buffer: RefCell<Option<BufferHandle>>, 162 debug_buffer: RefCell<Option<BufferHandle>>,
164} 163}