From 1c400e7ffa1f9d41d34bccc5e425c7b85c0decc8 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Thu, 20 Jul 2023 07:39:46 -0400 Subject: [PATCH] Remove no-longer-existing Rust feature default_free_fn --- server/shell.nix | 9 +++++++++ server/src/api/mod.rs | 4 ++-- server/src/db/mod.rs | 3 +-- server/src/entities/ticks.rs | 6 +++--- server/src/entities/users.rs | 4 ++-- server/src/main.rs | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 server/shell.nix diff --git a/server/shell.nix b/server/shell.nix new file mode 100644 index 0000000..96a8187 --- /dev/null +++ b/server/shell.nix @@ -0,0 +1,9 @@ +# DEVELOPMENT shell environment +{ pkgs ? import {} }: + +pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ + clang + ]; +} + diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index f4386a8..30cb521 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -8,7 +8,7 @@ mod tracks; pub(crate) mod update; use std::{ - default::default, + default::Default, env, fs, net::{IpAddr, Ipv4Addr}, }; @@ -83,7 +83,7 @@ pub(crate) fn start_server(db: DatabaseConnection) -> Rocket { .configure(Config { address: IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), secret_key: SecretKey::derive_from(&get_secret()), - ..default() + ..Config::default() }) .register("/", catchers![spa_index_redirect]) .manage(db) diff --git a/server/src/db/mod.rs b/server/src/db/mod.rs index b141c4f..8cb0052 100644 --- a/server/src/db/mod.rs +++ b/server/src/db/mod.rs @@ -1,5 +1,4 @@ use std::{ - default::default, env, ffi::{OsStr, OsString}, fs::File, @@ -30,7 +29,7 @@ fn get_env_var_or_file>(key: A) -> Option { if let Some(path) = env::var_os(file_key) { // open the file and read it let mut file = File::open(&path).unwrap_or_else(|_| panic!("no such file at {path:?}")); - let mut val: String = default(); + let mut val = String::new(); file.read_to_string(&mut val) .unwrap_or_else(|_| panic!("reading file at {path:?}")); Some(val) diff --git a/server/src/entities/ticks.rs b/server/src/entities/ticks.rs index 41d4107..7734cf8 100644 --- a/server/src/entities/ticks.rs +++ b/server/src/entities/ticks.rs @@ -1,6 +1,6 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 -use std::default::default; +use std::default::Default; use chrono::{Datelike, Timelike, Utc}; use sea_orm::entity::prelude::*; @@ -60,7 +60,7 @@ impl ActiveModel { minute: Set(now.minute().try_into().ok()), second: Set(now.second().try_into().ok()), has_time_info: Set(Some(1)), - ..default() + ..Default::default() } } pub(crate) fn on(date: Date, track_id: i32) -> Self { @@ -80,7 +80,7 @@ impl ActiveModel { minute: Set(now.minute().try_into().ok()), second: Set(now.second().try_into().ok()), has_time_info: Set(Some(1)), - ..default() + ..Default::default() } } } diff --git a/server/src/entities/users.rs b/server/src/entities/users.rs index 645f862..5805910 100644 --- a/server/src/entities/users.rs +++ b/server/src/entities/users.rs @@ -1,6 +1,6 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 -use std::default::default; +use std::default::Default; use bcrypt::*; // TODO Add option for argon2 https://docs.rs/argon2/latest/argon2/ @@ -57,7 +57,7 @@ impl ActiveModel { Ok(Self { name, password_hash, - ..default() + ..Default::default() }) } } diff --git a/server/src/main.rs b/server/src/main.rs index d6aad4d..3a5835c 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,4 +1,4 @@ -#![feature(default_free_fn, proc_macro_hygiene, decl_macro, never_type)] +#![feature(proc_macro_hygiene, decl_macro, never_type)] #[macro_use] extern crate rocket; mod api;