Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stackotter committed Sep 1, 2023
1 parent 4684733 commit 877917d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions bbfs-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::{fs::File, path::Path};

use anyhow::anyhow;
use argh::FromArgs;
Expand Down Expand Up @@ -65,7 +65,7 @@ fn get_data_dir() -> PathBuf {
data_dir
}

fn daemonize(data_dir: &PathBuf) {
fn daemonize(data_dir: &Path) {
let stdout =
File::create(data_dir.join("stdout.log")).expect("failed to create stdout log file");
let stderr =
Expand All @@ -75,7 +75,7 @@ fn daemonize(data_dir: &PathBuf) {

fn authenticate<Monster: CookieMonster>(
cookie_monster: Monster,
data_dir: &PathBuf,
data_dir: &Path,
) -> anyhow::Result<String> {
// Check for cached cookie
let cookie_cache_file = data_dir.join("cookie");
Expand Down
2 changes: 1 addition & 1 deletion bbfs-scrape/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
create_link_file, memberships_data::CourseMemberships, Course, CourseItem, CourseItemContent,
Item, SynthesizedDirectory, SynthesizedFile, User, LINK_FILE_EXT,
Item, SynthesizedDirectory, User, LINK_FILE_EXT,
};
use nix::errno::Errno;
use pct_str::PctStr;
Expand Down
2 changes: 1 addition & 1 deletion bbfs-scrape/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Item {
fn make_link_file(name: &str, link: &str) -> Item {
Item::SynthesizedFile(SynthesizedFile {
name: format!("{name}.{LINK_FILE_EXT}"),
contents: create_link_file(&link),
contents: create_link_file(link),
})
}
}
Expand Down
10 changes: 5 additions & 5 deletions cookie-monster/src/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use fantoccini::{elements::Element, Client, ClientBuilder, Locator};
use futures::{future::FutureExt, pin_mut, select};
use rpassword::read_password;
use std::io::{prelude::*, stdin, stdout};
use std::path::PathBuf;
use std::path::Path;
use std::process::Command;
use url::Url;

Expand Down Expand Up @@ -36,7 +36,7 @@ impl HeadlessCookieMonster {
.await?)
}

async fn complete_auth<DuoF: Fn(&str) -> ()>(
async fn complete_auth<DuoF: Fn(&str)>(
client: &Client,
handle_duo_code: DuoF,
) -> anyhow::Result<()> {
Expand All @@ -57,12 +57,12 @@ impl HeadlessCookieMonster {
}
_ = completion_task => Ok(()),
_ = failure_task => {
return Err(anyhow!("Incorrect username or password"));
Err(anyhow!("Incorrect username or password"))
}
}
}

fn eat_user_cookies<DuoF: Fn(&str) -> ()>(
fn eat_user_cookies<DuoF: Fn(&str)>(
username: &str,
password: &str,
handle_duo_code: DuoF,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl HeadlessCookieMonster {
}

impl CookieMonster for HeadlessCookieMonster {
fn authenticate(&self, _data_dir: &PathBuf) -> anyhow::Result<String> {
fn authenticate(&self, _data_dir: &Path) -> anyhow::Result<String> {
print!("Username: ");
let _ = stdout().flush();
let mut username = "".into();
Expand Down
5 changes: 2 additions & 3 deletions cookie-monster/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#[macro_use]
extern crate objc;

use std::path::PathBuf;
use ureq;
use std::path::Path;

use anyhow::anyhow;
use wry::webview::Url;
Expand All @@ -30,5 +29,5 @@ pub fn is_cookie_valid(cookie: &str) -> anyhow::Result<bool> {
}

pub trait CookieMonster {
fn authenticate(&self, data_dir: &PathBuf) -> anyhow::Result<String>;
fn authenticate(&self, data_dir: &Path) -> anyhow::Result<String>;
}
7 changes: 4 additions & 3 deletions cookie-monster/src/webview.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
fs::File,
io::Write,
path::{Path, PathBuf},
path::Path,
time::{Duration, Instant},
};

Expand All @@ -10,7 +10,7 @@ use anyhow::anyhow;
use wry::{
application::{
dpi::LogicalSize,
event::{Event, StartCause, WindowEvent},
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoopBuilder, EventLoopProxy},
platform::run_return::EventLoopExtRunReturn,
window::WindowBuilder,
Expand All @@ -24,6 +24,7 @@ use crate::CookieMonster;
enum UserEvent {
PageLoad(String),
Navigation(String),
#[allow(dead_code)]
GotCookie(String),
}

Expand Down Expand Up @@ -137,7 +138,7 @@ impl WebViewCookieMonster {
}

impl CookieMonster for WebViewCookieMonster {
fn authenticate(&self, data_dir: &PathBuf) -> anyhow::Result<String> {
fn authenticate(&self, data_dir: &Path) -> anyhow::Result<String> {
let cookie_file_buf = data_dir.join("tmp_cookie");
let cookie_file = cookie_file_buf.as_path();

Expand Down

0 comments on commit 877917d

Please sign in to comment.