server: address lint
This commit is contained in:
parent
934cb9d91b
commit
7218c13b9e
@ -1,3 +1,6 @@
|
||||
// Rocket generates a lot of warnings for handlers
|
||||
// TODO: figure out why
|
||||
#![allow(unreachable_patterns)]
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
use std::{error::Error, io::Cursor, str::FromStr};
|
||||
|
||||
@ -14,19 +14,16 @@ use lol_html::{
|
||||
RewriteStrSettings,
|
||||
};
|
||||
use maplit::{hashmap, hashset};
|
||||
use scraper::{error::SelectorErrorKind, Html, Selector};
|
||||
use scraper::{Html, Selector};
|
||||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use crate::newsreader::{
|
||||
extract_thread_id, is_newsreader_search, is_newsreader_thread, make_news_tag,
|
||||
};
|
||||
const NON_EXISTENT_SITE_NAME: &'static str = "NO-SUCH-SITE";
|
||||
use crate::newsreader::{extract_thread_id, is_newsreader_thread};
|
||||
|
||||
// TODO: figure out how to use Cow
|
||||
#[async_trait]
|
||||
trait Transformer: Send + Sync {
|
||||
fn should_run(&self, addr: &Option<Url>, _html: &str) -> bool {
|
||||
fn should_run(&self, _addr: &Option<Url>, _html: &str) -> bool {
|
||||
true
|
||||
}
|
||||
// TODO: should html be something like `html_escape` uses:
|
||||
@ -138,7 +135,7 @@ struct FrameImages;
|
||||
|
||||
#[async_trait]
|
||||
impl Transformer for FrameImages {
|
||||
async fn transform(&self, link: &Option<Url>, html: &str) -> Result<String, TransformError> {
|
||||
async fn transform(&self, _: &Option<Url>, html: &str) -> Result<String, TransformError> {
|
||||
Ok(rewrite_str(
|
||||
html,
|
||||
RewriteStrSettings {
|
||||
@ -213,7 +210,7 @@ impl SlurpContents {
|
||||
|
||||
#[async_trait]
|
||||
impl Transformer for SlurpContents {
|
||||
fn should_run(&self, link: &Option<Url>, html: &str) -> bool {
|
||||
fn should_run(&self, link: &Option<Url>, _: &str) -> bool {
|
||||
if let Some(link) = link {
|
||||
return self.get_selectors(link).is_some();
|
||||
}
|
||||
@ -580,7 +577,6 @@ impl FromStr for Query {
|
||||
let mut tag = None;
|
||||
let mut uid = None;
|
||||
let mut remainder = Vec::new();
|
||||
let site_prefix = make_news_tag("");
|
||||
let mut is_notmuch = false;
|
||||
let mut is_newsreader = false;
|
||||
for word in s.split_whitespace() {
|
||||
|
||||
@ -14,7 +14,7 @@ const THREAD_PREFIX: &'static str = "news:";
|
||||
use crate::{
|
||||
compute_offset_limit,
|
||||
error::ServerError,
|
||||
graphql::{Body, Email, Html, Message, NewsPost, Tag, Thread, ThreadSummary},
|
||||
graphql::{NewsPost, Tag, Thread, ThreadSummary},
|
||||
AddOutlink, EscapeHtml, FrameImages, InlineStyle, SanitizeHtml, SlurpContents, StripHtml,
|
||||
Transformer,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user