Enable some warnings
This commit is contained in:
parent
baa49107f1
commit
00bcdddc62
8 changed files with 30 additions and 15 deletions
|
|
@ -304,10 +304,10 @@ impl Serialize for Snowflake {
|
||||||
|
|
||||||
struct SnowflakeVisitor;
|
struct SnowflakeVisitor;
|
||||||
|
|
||||||
impl<'de> de::Visitor<'de> for SnowflakeVisitor {
|
impl de::Visitor<'_> for SnowflakeVisitor {
|
||||||
type Value = Snowflake;
|
type Value = Snowflake;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(formatter, "a base36 string of length 13")
|
write!(formatter, "a base36 string of length 13")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,11 @@ impl MsgStore<LogMsg> for Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Log for Logger {
|
impl Log for Logger {
|
||||||
fn enabled(&self, _metadata: &log::Metadata) -> bool {
|
fn enabled(&self, _metadata: &log::Metadata<'_>) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn log(&self, record: &log::Record) {
|
fn log(&self, record: &log::Record<'_>) {
|
||||||
if !self.enabled(record.metadata()) {
|
if !self.enabled(record.metadata()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -1,5 +1,20 @@
|
||||||
|
#![deny(unsafe_code)]
|
||||||
|
// Rustc lint groups
|
||||||
|
#![warn(future_incompatible)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
|
// Rustc lints
|
||||||
|
#![warn(noop_method_call)]
|
||||||
|
#![warn(single_use_lifetimes)]
|
||||||
|
#![warn(trivial_numeric_casts)]
|
||||||
|
#![warn(unused_crate_dependencies)]
|
||||||
|
#![warn(unused_extern_crates)]
|
||||||
|
#![warn(unused_import_braces)]
|
||||||
|
#![warn(unused_lifetimes)]
|
||||||
|
#![warn(unused_qualifications)]
|
||||||
|
// Clippy lints
|
||||||
#![warn(clippy::use_self)]
|
#![warn(clippy::use_self)]
|
||||||
|
|
||||||
|
// TODO Enable warn(unreachable_pub)?
|
||||||
// TODO Clean up use and manipulation of toss Pos and Size
|
// TODO Clean up use and manipulation of toss Pos and Size
|
||||||
|
|
||||||
mod euph;
|
mod euph;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ impl Ui {
|
||||||
terminal: &mut Terminal,
|
terminal: &mut Terminal,
|
||||||
vault: Vault,
|
vault: Vault,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
logger_rx: mpsc::UnboundedReceiver<()>,
|
logger_rx: UnboundedReceiver<()>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let (event_tx, event_rx) = mpsc::unbounded_channel();
|
let (event_tx, event_rx) = mpsc::unbounded_channel();
|
||||||
let crossterm_lock = Arc::new(FairMutex::new(()));
|
let crossterm_lock = Arc::new(FairMutex::new(()));
|
||||||
|
|
@ -107,8 +107,8 @@ impl Ui {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_on_log_event(
|
async fn update_on_log_event(
|
||||||
mut logger_rx: mpsc::UnboundedReceiver<()>,
|
mut logger_rx: UnboundedReceiver<()>,
|
||||||
event_tx: &mpsc::UnboundedSender<UiEvent>,
|
event_tx: &UnboundedSender<UiEvent>,
|
||||||
) {
|
) {
|
||||||
while let Some(()) = logger_rx.recv().await {
|
while let Some(()) = logger_rx.recv().await {
|
||||||
if event_tx.send(UiEvent::Redraw).is_err() {
|
if event_tx.send(UiEvent::Redraw).is_err() {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ impl<I> Blocks<I> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> vec_deque::Iter<Block<I>> {
|
pub fn iter(&self) -> vec_deque::Iter<'_, Block<I>> {
|
||||||
self.blocks.iter()
|
self.blocks.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,14 @@ impl Widget for Float {
|
||||||
let available = (size.width - inner_size.width) as f32;
|
let available = (size.width - inner_size.width) as f32;
|
||||||
// Biased towards the left if horizontal lands exactly on the
|
// Biased towards the left if horizontal lands exactly on the
|
||||||
// boundary between two cells
|
// boundary between two cells
|
||||||
inner_pos.x = (horizontal * available as f32).floor().min(available) as i32;
|
inner_pos.x = (horizontal * available).floor().min(available) as i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(vertical) = self.vertical {
|
if let Some(vertical) = self.vertical {
|
||||||
let available = (size.height - inner_size.height) as f32;
|
let available = (size.height - inner_size.height) as f32;
|
||||||
// Biased towards the top if vertical lands exactly on the boundary
|
// Biased towards the top if vertical lands exactly on the boundary
|
||||||
// between two cells
|
// between two cells
|
||||||
inner_pos.y = (vertical * available as f32).floor().min(available) as i32;
|
inner_pos.y = (vertical * available).floor().min(available) as i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.push(inner_pos, inner_size);
|
frame.push(inner_pos, inner_size);
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ impl EuphRequest {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_msgs(tx: &Transaction, room: &str, msgs: Vec<Message>) -> rusqlite::Result<()> {
|
fn insert_msgs(tx: &Transaction<'_>, room: &str, msgs: Vec<Message>) -> rusqlite::Result<()> {
|
||||||
let mut insert_msg = tx.prepare(
|
let mut insert_msg = tx.prepare(
|
||||||
"
|
"
|
||||||
INSERT OR REPLACE INTO euph_msgs (
|
INSERT OR REPLACE INTO euph_msgs (
|
||||||
|
|
@ -475,7 +475,7 @@ impl EuphRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_span(
|
fn add_span(
|
||||||
tx: &Transaction,
|
tx: &Transaction<'_>,
|
||||||
room: &str,
|
room: &str,
|
||||||
start: Option<Snowflake>,
|
start: Option<Snowflake>,
|
||||||
end: Option<Snowflake>,
|
end: Option<Snowflake>,
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ pub fn migrate(conn: &mut Connection) -> rusqlite::Result<()> {
|
||||||
tx.commit()
|
tx.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
const MIGRATIONS: [fn(&mut Transaction) -> rusqlite::Result<()>; 2] = [m1, m2];
|
const MIGRATIONS: [fn(&mut Transaction<'_>) -> rusqlite::Result<()>; 2] = [m1, m2];
|
||||||
|
|
||||||
fn m1(tx: &mut Transaction) -> rusqlite::Result<()> {
|
fn m1(tx: &mut Transaction<'_>) -> rusqlite::Result<()> {
|
||||||
tx.execute_batch(
|
tx.execute_batch(
|
||||||
"
|
"
|
||||||
CREATE TABLE euph_rooms (
|
CREATE TABLE euph_rooms (
|
||||||
|
|
@ -76,7 +76,7 @@ fn m1(tx: &mut Transaction) -> rusqlite::Result<()> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn m2(tx: &mut Transaction) -> rusqlite::Result<()> {
|
fn m2(tx: &mut Transaction<'_>) -> rusqlite::Result<()> {
|
||||||
tx.execute_batch(
|
tx.execute_batch(
|
||||||
"
|
"
|
||||||
CREATE TABLE euph_cookies (
|
CREATE TABLE euph_cookies (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue