Skip to content

Commit

Permalink
fix: remove #[used] from non-static fields
Browse files Browse the repository at this point in the history
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] rust-lang/rust#82668
[1] https://rust-lang.github.io/rfcs/2386-used.html
  • Loading branch information
austin-ray committed Apr 4, 2021
1 parent 618b603 commit 0179bf3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/bar_items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use buffer_plugin::BufferPlugin;
use status::Status;

pub struct BarItems {
#[used]
#[allow(dead_code)]
status: BarItem,
#[used]
#[allow(dead_code)]
buffer_name: BarItem,
#[used]
#[allow(dead_code)]
buffer_plugin: BarItem,
}

Expand Down
2 changes: 1 addition & 1 deletion src/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use weechat::{
use crate::Servers;

pub struct Completions {
#[used]
#[allow(dead_code)]
servers: CompletionHook,
}

Expand Down
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,14 @@ impl SignalCallback for Servers {

struct Matrix {
servers: Servers,
#[used]
#[allow(dead_code)]
commands: Commands,
#[used]
config: ConfigHandle,
#[used]
#[allow(dead_code)]
bar_items: BarItems,
#[used]
#[allow(dead_code)]
typing_notice_signal: SignalHook,
#[used]
#[allow(dead_code)]
completions: Completions,
debug_buffer: RefCell<Option<BufferHandle>>,
}
Expand Down

0 comments on commit 0179bf3

Please sign in to comment.