Commit c7a09cc4dc
c7a09cc4dcde4368ce3075ab29e3f168bd58a87f
parent: 855c984560
Unsigned
Damir Jelić <poljar@termina.org.uk> · 2020-07-12 17:44 UTC
weechat-matrix: Fix some clippy issues.
Layout: unified · split
src/lib.rs
+3 −6
| @@ -12,7 +12,6 @@ mod server; |
| 12 | 12 | use std::cell::{Ref, RefCell, RefMut}; |
| 13 | 13 | use std::collections::HashMap; |
| 14 | 14 | use std::rc::Rc; |
| 15 | | use tracing_subscriber; |
| 16 | 15 | |
| 17 | 16 | use weechat::{ |
| 18 | 17 | buffer::{Buffer, BufferHandle}, |
| @@ -100,10 +99,8 @@ impl BarItemCallback for Servers { |
| 100 | 99 | for room in server.room_buffers().values() { |
| 101 | 100 | let room_buffer = room.weechat_buffer(); |
| 102 | 101 | |
| 103 | | if &room_buffer == buffer { |
| 104 | | if room.room().is_encrypted() { |
| 105 | | return server.config().look().encrypted_room_sign(); |
| 106 | | } |
| 102 | if &room_buffer == buffer && room.room().is_encrypted() { |
| 103 | return server.config().look().encrypted_room_sign(); |
| 107 | 104 | } |
| 108 | 105 | } |
| 109 | 106 | } |
| @@ -144,7 +141,7 @@ impl WeechatPlugin for Matrix { |
| 144 | 141 | let plugin = Matrix { |
| 145 | 142 | servers: servers.clone(), |
| 146 | 143 | commands, |
| 147 | | config: config.clone(), |
| 144 | config, |
| 148 | 145 | status_bar, |
| 149 | 146 | debug_buffer: RefCell::new(None), |
| 150 | 147 | }; |
src/room_buffer.rs
+3 −7
| @@ -78,7 +78,6 @@ impl BufferInputCallbackAsync for MatrixRoom { |
| 78 | 78 | } |
| 79 | 79 | } else { |
| 80 | 80 | buffer.print("Error not connected"); |
| 81 | | return; |
| 82 | 81 | } |
| 83 | 82 | } |
| 84 | 83 | } |
| @@ -188,7 +187,7 @@ impl RoomBuffer { |
| 188 | 187 | |
| 189 | 188 | if room_name == "#" { |
| 190 | 189 | "##".to_owned() |
| 191 | | } else if room_name.starts_with("#") { |
| 190 | } else if room_name.starts_with('#') { |
| 192 | 191 | room_name |
| 193 | 192 | } else { |
| 194 | 193 | // TODO: only do this for non-direct chats |
| @@ -277,11 +276,8 @@ impl RoomBuffer { |
| 277 | 276 | .unwrap_or_default() |
| 278 | 277 | .as_secs(); |
| 279 | 278 | |
| 280 | | match &event.content { |
| 281 | | MessageEventContent::Text(t) => { |
| 282 | | self.handle_text_message(&sender.to_string(), timestamp, t) |
| 283 | | } |
| 284 | | _ => (), |
| 279 | if let MessageEventContent::Text(t) = &event.content { |
| 280 | self.handle_text_message(&sender.to_string(), timestamp, t) |
| 285 | 281 | } |
| 286 | 282 | } |
| 287 | 283 | |
src/server.rs
+2 −3
| @@ -150,10 +150,9 @@ impl Connection { |
| 150 | 150 | relates_to: None, |
| 151 | 151 | }); |
| 152 | 152 | |
| 153 | | let ret = client |
| 153 | client |
| 154 | 154 | .room_send(&room_id, content, Some(Uuid::new_v4())) |
| 155 | | .await; |
| 156 | | ret |
| 155 | .await |
| 157 | 156 | }) |
| 158 | 157 | .await; |
| 159 | 158 | |