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;
1212use std::cell::{Ref, RefCell, RefMut};
1313use std::collections::HashMap;
1414use std::rc::Rc;
15use tracing_subscriber;
1615
1716use weechat::{
1817 buffer::{Buffer, BufferHandle},
@@ -100,10 +99,8 @@ impl BarItemCallback for Servers {
10099 for room in server.room_buffers().values() {
101100 let room_buffer = room.weechat_buffer();
102101
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();
107104 }
108105 }
109106 }
@@ -144,7 +141,7 @@ impl WeechatPlugin for Matrix {
144141 let plugin = Matrix {
145142 servers: servers.clone(),
146143 commands,
147 config: config.clone(),
144 config,
148145 status_bar,
149146 debug_buffer: RefCell::new(None),
150147 };
src/room_buffer.rs +3 −7
@@ -78,7 +78,6 @@ impl BufferInputCallbackAsync for MatrixRoom {
7878 }
7979 } else {
8080 buffer.print("Error not connected");
81 return;
8281 }
8382 }
8483}
@@ -188,7 +187,7 @@ impl RoomBuffer {
188187
189188 if room_name == "#" {
190189 "##".to_owned()
191 } else if room_name.starts_with("#") {
190 } else if room_name.starts_with('#') {
192191 room_name
193192 } else {
194193 // TODO: only do this for non-direct chats
@@ -277,11 +276,8 @@ impl RoomBuffer {
277276 .unwrap_or_default()
278277 .as_secs();
279278
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)
285281 }
286282 }
287283
src/server.rs +2 −3
@@ -150,10 +150,9 @@ impl Connection {
150150 relates_to: None,
151151 });
152152
153 let ret = client
153 client
154154 .room_send(&room_id, content, Some(Uuid::new_v4()))
155 .await;
156 ret
155 .await
157156 })
158157 .await;
159158