Ran rustfmt and clippy
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use chrono::NaiveDate;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use uuid::Uuid;
|
||||
use chrono::NaiveDate;
|
||||
|
||||
// Info from here:
|
||||
// https://scryfall.com/docs/api/cards
|
||||
@@ -112,8 +112,7 @@ struct ScryfallCard {
|
||||
#[serde(rename = "preview.source_uri")]
|
||||
pub preview_source_uri: Option<String>, // URI
|
||||
#[serde(rename = "preview.source")]
|
||||
pub preview_source: Option<String>
|
||||
|
||||
pub preview_source: Option<String>,
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/cards#card-face-objects
|
||||
@@ -146,7 +145,7 @@ struct ScryfallCardFaceObject {
|
||||
pub printed_type_line: Option<String>,
|
||||
pub toughness: Option<String>,
|
||||
pub type_line: Option<String>,
|
||||
pub watermark: Option<String>
|
||||
pub watermark: Option<String>,
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/cards#related-card-objects
|
||||
@@ -158,7 +157,7 @@ struct ScryfallRelatedCardObject {
|
||||
pub component: Component,
|
||||
pub name: String,
|
||||
pub type_line: String,
|
||||
pub uri: String // URI
|
||||
pub uri: String, // URI
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
@@ -176,7 +175,7 @@ enum Colour {
|
||||
#[serde(rename = "C")] // I don't think it's meant to work like this... but eh
|
||||
Colourless,
|
||||
#[serde(rename = "T")] // See "Sole Performer"
|
||||
Tap
|
||||
Tap,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
@@ -215,7 +214,7 @@ struct FormatLegalities {
|
||||
duel: Legality,
|
||||
oldschool: Legality,
|
||||
premodern: Legality,
|
||||
predh: Legality
|
||||
predh: Legality,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -232,7 +231,7 @@ enum BorderColour {
|
||||
#[serde(rename = "silver")]
|
||||
Silver,
|
||||
#[serde(rename = "gold")]
|
||||
Gold
|
||||
Gold,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -243,7 +242,7 @@ enum Finish {
|
||||
#[serde(rename = "nonfoil")]
|
||||
NonFoil,
|
||||
#[serde(rename = "etched")]
|
||||
Etched
|
||||
Etched,
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/frames#frames
|
||||
@@ -260,7 +259,7 @@ enum Frame {
|
||||
#[serde(rename = "2015")]
|
||||
Fifteen,
|
||||
#[serde(rename = "future")]
|
||||
Future
|
||||
Future,
|
||||
}
|
||||
|
||||
// https://scryfall.com/docs/api/frames#frame-effects
|
||||
@@ -316,7 +315,7 @@ enum FrameEffect {
|
||||
#[serde(rename = "spree")]
|
||||
Spree,
|
||||
#[serde(rename = "fullart")]
|
||||
FullArt
|
||||
FullArt,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -325,13 +324,13 @@ enum Game {
|
||||
#[serde(rename = "paper")]
|
||||
Paper,
|
||||
#[serde(rename = "mtgo")]
|
||||
MTGO,
|
||||
Mtgo,
|
||||
#[serde(rename = "arena")]
|
||||
Arena,
|
||||
#[serde(rename = "astral")]
|
||||
Astral,
|
||||
#[serde(rename = "sega")]
|
||||
Sega
|
||||
Sega,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -344,7 +343,7 @@ enum ImageStatus {
|
||||
#[serde(rename = "lowres")]
|
||||
LowResolution,
|
||||
#[serde(rename = "highres_scan")]
|
||||
HighResolutionScan
|
||||
HighResolutionScan,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -355,7 +354,7 @@ struct ImageURIs {
|
||||
art_crop: Option<String>,
|
||||
large: Option<String>,
|
||||
normal: Option<String>,
|
||||
small: Option<String>
|
||||
small: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -366,7 +365,7 @@ struct Prices {
|
||||
usd_etched: Option<String>,
|
||||
eur: Option<String>,
|
||||
eur_foil: Option<String>,
|
||||
tix: Option<String>
|
||||
tix: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -383,7 +382,7 @@ enum Rarity {
|
||||
#[serde(rename = "mythic")]
|
||||
Mythic,
|
||||
#[serde(rename = "bonus")]
|
||||
Bonus
|
||||
Bonus,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -408,7 +407,7 @@ enum SecurityStamp {
|
||||
#[serde(rename = "arena")]
|
||||
Arena,
|
||||
#[serde(rename = "heart")]
|
||||
Heart
|
||||
Heart,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -427,9 +426,9 @@ enum Component {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::path::PathBuf;
|
||||
use std::fs;
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn deserialise_nissa() {
|
||||
@@ -475,17 +474,16 @@ mod tests {
|
||||
line.push('}');
|
||||
}
|
||||
|
||||
if line.len() < 1 { continue };
|
||||
let a_card: Result<ScryfallCard, serde_json::Error> = serde_json::from_str(&line.as_ref());
|
||||
match a_card {
|
||||
Err(error) => {
|
||||
if line.is_empty() {
|
||||
continue;
|
||||
};
|
||||
let a_card: Result<ScryfallCard, serde_json::Error> =
|
||||
serde_json::from_str(line.as_ref());
|
||||
if let Err(error) = a_card {
|
||||
println!("{:#?}", line);
|
||||
println!("{:#?}", error);
|
||||
panic!();
|
||||
},
|
||||
Ok(_) => (),
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user