mirror of
https://github.com/MalteT/mensa.git
synced 2024-10-22 21:59:17 +02:00
Fix linter warnings
This commit is contained in:
parent
36c8d6adc8
commit
80afb5bd11
|
@ -1,5 +1,3 @@
|
|||
cargo-features = ["edition2021"]
|
||||
|
||||
[package]
|
||||
name = "mensa"
|
||||
version = "0.5.0"
|
||||
|
|
2
src/cache/fetchable.rs
vendored
2
src/cache/fetchable.rs
vendored
|
@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::error::Result;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "T", untagged)]
|
||||
pub enum Fetchable<T> {
|
||||
/// The value does not exist, but can be fetched.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(macro_attributes_in_derive_output)]
|
||||
//! <img src="https://raw.githubusercontent.com/MalteT/mensa/main/static/logo.png" alt="mensa CLI logo" width="400" align="right">
|
||||
//!
|
||||
//! [![tests](https://github.com/MalteT/mensa/actions/workflows/rust.yml/badge.svg)](https://github.com/MalteT/mensa/actions/workflows/rust.yml)
|
||||
|
|
|
@ -14,7 +14,7 @@ mod dummy;
|
|||
pub use self::dummy::DummyApi as DefaultApi;
|
||||
|
||||
/// Assortment of headers relevant to the program.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub struct Headers {
|
||||
pub etag: Option<String>,
|
||||
|
|
|
@ -55,33 +55,29 @@ impl From<reqwest::header::HeaderMap> for Headers {
|
|||
use reqwest::header::*;
|
||||
let etag = map
|
||||
.get(ETAG)
|
||||
.map(|raw| {
|
||||
.and_then(|raw| {
|
||||
let utf8 = raw.to_str().ok()?;
|
||||
Some(utf8.to_string())
|
||||
})
|
||||
.flatten();
|
||||
});
|
||||
let this_page = map
|
||||
.get("x-current-page")
|
||||
.map(|raw| {
|
||||
.and_then(|raw| {
|
||||
let utf8 = raw.to_str().ok()?;
|
||||
utf8.parse().ok()
|
||||
})
|
||||
.flatten();
|
||||
});
|
||||
let next_page = map
|
||||
.get(LINK)
|
||||
.map(|raw| {
|
||||
.and_then(|raw| {
|
||||
let utf8 = raw.to_str().ok()?;
|
||||
let captures = LINK_NEXT_PAGE_RE.captures(utf8)?;
|
||||
Some(captures[1].to_owned())
|
||||
})
|
||||
.flatten();
|
||||
});
|
||||
let last_page = map
|
||||
.get("x-total-pages")
|
||||
.map(|raw| {
|
||||
.and_then(|raw| {
|
||||
let utf8 = raw.to_str().ok()?;
|
||||
utf8.parse().ok()
|
||||
})
|
||||
.flatten();
|
||||
});
|
||||
Self {
|
||||
etag,
|
||||
this_page,
|
||||
|
|
Loading…
Reference in a new issue