summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlara Modin <klarasmodin@gmail.com>2022-06-20 21:14:08 +0200
committerKlara Modin <klarasmodin@gmail.com>2022-06-20 21:15:52 +0200
commit6196fcf61a59127620f2d2c352a1a9b945c51ef9 (patch)
treea37365aca8f7f7b760ba8871138932093074b42a
parent321852fe671e4e158db82a45d51881937623db9d (diff)
get rid of some warnings
-rw-r--r--src/client.rs4
-rw-r--r--src/main.rs3
-rw-r--r--src/server_int.rs3
-rw-r--r--src/ui.rs10
4 files changed, 9 insertions, 11 deletions
diff --git a/src/client.rs b/src/client.rs
index a4b4b81..7e51885 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,4 +1,4 @@
-use server_int::{ServerBuilder,Server,Message};
+use server_int::{ServerBuilder,Server};
use user_int::{SessionBuilder,Session};
use ui::*;
use std::thread;
@@ -81,7 +81,7 @@ impl Client {
Ok(())
}
- pub fn join(mut self) -> io::Result<(Client)> {
+ pub fn join(mut self) -> io::Result<Client> {
self.session = self.session_handle
.expect("Has to be running!")
.join().unwrap()?;
diff --git a/src/main.rs b/src/main.rs
index 1f60af8..a8a8ffb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,7 +7,6 @@ mod user_int;
mod tests;
mod client;
-use std::thread;
use std::str::FromStr;
use std::sync::{Arc,Mutex};
@@ -61,5 +60,5 @@ fn main() {
client.attach(ui);
client.connect().unwrap();
- client = client.join().unwrap();
+ client.join().unwrap();
}
diff --git a/src/server_int.rs b/src/server_int.rs
index cd6d52b..cf3edda 100644
--- a/src/server_int.rs
+++ b/src/server_int.rs
@@ -72,10 +72,9 @@ impl Message {
message.command = part.next()
.map_or(String::new(), |x| x.to_string().to_uppercase());
- let mut trailing = String::new();
while let Some(p) = part.next() {
if p.starts_with(":") {
- trailing = p.to_string();
+ let mut trailing = p.to_string();
trailing.remove(0);
while let Some(p) = part.next() {
trailing.push(' ');
diff --git a/src/ui.rs b/src/ui.rs
index 89f6fb7..0a0b254 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -54,7 +54,7 @@ impl UI {
pub fn nick(&mut self, nick: &str) {
self.nick = format!("[{}] ", nick);
- let (max_y, max_x) = UI::getmaxyx_tup();
+ let (max_y, _) = UI::getmaxyx_tup();
mv(max_y-1, 0);
deleteln();
printw(&self.nick);
@@ -65,7 +65,7 @@ impl UI {
pub fn chan(&mut self, chan: &str) {
let (y, x) = UI::getyx_tup();
mv(0, 0);
- for i in 0..self.chan.len() {
+ for _ in 0..self.chan.len() {
printw(" ");
}
@@ -132,7 +132,8 @@ impl UI {
}
fn getstr_unblocking(&mut self) -> Option<String> {
- while let input = getch() {
+ loop {
+ let input = getch();
if let Some(ch) = char::from_u32(input as u32) {
match ch {
'\n' => {
@@ -184,7 +185,6 @@ impl UI {
}
}
}
- None
}
pub fn print_message(&mut self, message: &Message) {
@@ -228,7 +228,7 @@ impl UI {
fn scroll(&mut self, len: i32) {
mv(1, 0);
- for i in 0..len {
+ for _ in 0..len {
deleteln();
}
self.output_y-=len;