Skip to content

Commit

Permalink
Fix warnings and lints
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed May 25, 2024
1 parent d122dbb commit 9f0b127
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.74
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: sudo apt install libssl-dev
Expand Down
2 changes: 1 addition & 1 deletion bot/src/module/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl command::MessageHook for ActivePoll {
}

for word in common::words::trimmed(m) {
if self.options.get(&word.to_lowercase()).is_none() {
if !self.options.contains_key(&word.to_lowercase()) {
continue;
}

Expand Down
7 changes: 0 additions & 7 deletions bot/src/sys/windows/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ use std::ffi::{OsStr, OsString};
use std::os::windows::ffi::{OsStrExt as _, OsStringExt};

pub(crate) trait ToWide {
/// Encode into a wide string.
fn to_wide(&self) -> Vec<u16>;

/// Encode into a null-terminated wide string.
fn to_wide_null(&self) -> Vec<u16>;
}
Expand All @@ -13,10 +10,6 @@ impl<T> ToWide for T
where
T: AsRef<OsStr>,
{
fn to_wide(&self) -> Vec<u16> {
self.as_ref().encode_wide().collect()
}

fn to_wide_null(&self) -> Vec<u16> {
self.as_ref().encode_wide().chain(Some(0)).collect()
}
Expand Down
4 changes: 2 additions & 2 deletions crates/oxidize-api/src/spotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ impl Spotify {
}

/// Convert a page object into a stream.
pub fn page_as_stream<'a, T: 'a>(&'a self, page: Page<T>) -> impl Stream<Item = Result<T>> + 'a
pub fn page_as_stream<'a, T>(&'a self, page: Page<T>) -> impl Stream<Item = Result<T>> + 'a
where
T: Send + DeserializeOwned,
T: 'a + Send + DeserializeOwned,
{
async_stream::try_stream! {
let mut current = page.items.into_iter();
Expand Down
4 changes: 2 additions & 2 deletions crates/oxidize-api/src/twitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ impl Twitch {
}

/// Perform pagination over the given request.
fn page<'a, T: 'a>(request: RequestBuilder<'a>) -> impl Stream<Item = Result<T>> + 'a
fn page<'a, T>(request: RequestBuilder<'a>) -> impl Stream<Item = Result<T>> + 'a
where
T: de::DeserializeOwned,
T: 'a + de::DeserializeOwned,
{
async_stream::try_stream! {
let initial = request.execute().await?.json::<model::Page<T>>()?;
Expand Down
4 changes: 2 additions & 2 deletions crates/oxidize-chat/src/respond.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::{borrow::Cow, fmt};
use thiserror::Error;

/// Used to consistently format an IRC response.
pub fn respond<'a, M: 'a>(name: &'a str, m: M) -> impl fmt::Display + 'a
pub fn respond<'a, M>(name: &'a str, m: M) -> impl fmt::Display + 'a
where
M: fmt::Display,
M: 'a + fmt::Display,
{
NameRespond { name, m }
}
Expand Down
20 changes: 0 additions & 20 deletions crates/oxidize-chat/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
use std::future::Future;

use anyhow::Result;

pub(crate) trait Driver<'a> {
/// Drive the given future.
fn drive<F>(&mut self, future: F)
where
F: 'a + Send + Future<Output = Result<()>>;
}

impl<'a> Driver<'a> for Vec<common::BoxFuture<'a, Result<()>>> {
fn drive<F>(&mut self, future: F)
where
F: 'a + Send + Future<Output = Result<()>>,
{
self.push(Box::pin(future));
}
}

pub(crate) struct Urls<'a> {
message: &'a str,
}
Expand Down
11 changes: 1 addition & 10 deletions crates/oxidize-oauth2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use api::setbac::Connection;
use async_fuse::Fuse;
use async_injector::{Injector, Key};
use common::Duration;
use thiserror::Error;
use tokio::time::Instant;

/// Connection metadata.
Expand Down Expand Up @@ -38,14 +37,6 @@ pub trait ConnectionIntegration {
fn update_connection(&self, id: &str, meta: ConnectionIntegrationMeta);
}

#[derive(Debug, Error)]
#[error("Missing OAuth 2.0 Connection: {0}")]
pub(crate) struct MissingTokenError(&'static str);

#[derive(Debug, Error)]
#[error("Connection receive was cancelled")]
pub(crate) struct CancelledToken(());

struct ConnectionFactory<I> {
setbac: Option<api::Setbac>,
id: &'static str,
Expand Down Expand Up @@ -318,7 +309,7 @@ where
});
}

if check_interval.as_ref().is_empty() != !needs_interval {
if check_interval.as_ref().is_empty() == needs_interval {
check_interval.set(if needs_interval {
Fuse::new(tokio::time::interval(check_interval_duration.as_std()))
} else {
Expand Down

0 comments on commit 9f0b127

Please sign in to comment.