runs rustfmt, removes unused imports

This commit is contained in:
2019-06-18 15:49:10 +02:00
parent 9b3df58a08
commit f619f7229b
4 changed files with 33 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
use crate::*;
use crate::schema::players;
use crate::*;
#[derive(Queryable)]
pub struct Player {
@@ -13,7 +13,7 @@ pub struct Player {
}
#[derive(Insertable)]
#[table_name="players"]
#[table_name = "players"]
pub struct NewPlayer<'a> {
name: &'a str,
cp: i32,
@@ -23,24 +23,26 @@ pub struct NewPlayer<'a> {
}
impl<'a> NewPlayer<'a> {
fn new(
name: &'a str,
wealth: Option<(i32,i32,i32,i32)>,
) -> Self {
let (cp,sp,gp,pp) = wealth.unwrap_or((0,0,0,0));
NewPlayer { name, cp, sp, gp, pp }
fn new(name: &'a str, wealth: Option<(i32, i32, i32, i32)>) -> Self {
let (cp, sp, gp, pp) = wealth.unwrap_or((0, 0, 0, 0));
NewPlayer {
name,
cp,
sp,
gp,
pp,
}
}
fn insert(&self) -> Result<(),()> {
fn insert(&self) -> Result<(), ()> {
Err(())
}
}
#[cfg(test)]
mod tests {
use crate::tests;
use super::*;
use crate::tests;
#[test]
fn new_player_only_with_name() {