From 9829bbfcd57c57e237c6aacb96a78d0b9f5bab68 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 29 Jun 2021 22:44:11 -0600 Subject: lol no generics --- src/cli/make_migrations.rs | 4 ++-- src/cli/migrate.rs | 7 +++---- src/cli/mod.rs | 6 +++--- src/cli/run_server.rs | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/cli') diff --git a/src/cli/make_migrations.rs b/src/cli/make_migrations.rs index b0cd341..e0653b6 100644 --- a/src/cli/make_migrations.rs +++ b/src/cli/make_migrations.rs @@ -7,7 +7,7 @@ use structopt::StructOpt; use crate::db::migration::{CreateModelOption, DatabaseChange, Migration}; use crate::db::models::{Field, ModelMeta}; -use crate::{db::backend::Connectable, Settings, UrlMap}; +use crate::{Settings, UrlMap}; #[derive(StructOpt)] /// Generate migrations @@ -101,7 +101,7 @@ impl From<&[Migration]> for AppTablesState { } impl MakeMigrations { - pub fn execute(self, _urls: UrlMap, settings: Settings) { + pub fn execute(self, _urls: UrlMap, settings: Settings) { for app in settings.installed_apps { let expected_table_state = AppTablesState::from(app.models); let actual_table_state = AppTablesState::from(app.migrations); diff --git a/src/cli/migrate.rs b/src/cli/migrate.rs index acc59d3..4085fe1 100644 --- a/src/cli/migrate.rs +++ b/src/cli/migrate.rs @@ -1,6 +1,5 @@ use structopt::StructOpt; -use crate::db::backend::Connectable; use crate::db::migration::{CreateModelOption, DatabaseChange}; use crate::db::models::Field; use crate::{Settings, UrlMap}; @@ -29,15 +28,15 @@ const CREATE_MIGRATION_TABLE: DatabaseChange = DatabaseChange::CreateModel { }; impl Migrate { - pub fn execute(self, _urls: UrlMap, settings: Settings) { + pub fn execute(self, _urls: UrlMap, settings: Settings) { let database = settings.database; let connection = database.connect().unwrap(); - CREATE_MIGRATION_TABLE.apply::("tosin_meta", &connection); + CREATE_MIGRATION_TABLE.apply("tosin_meta", &connection); for app in settings.installed_apps { for migration in app.migrations { - migration.apply::(app.name, &connection); + migration.apply(app.name, &connection); } } } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 5bff8ae..347430c 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,6 +1,6 @@ use structopt::StructOpt; -use crate::{db::backend::Connectable, Settings, UrlMap}; +use crate::{Settings, UrlMap}; mod make_migrations; mod migrate; @@ -14,7 +14,7 @@ enum Command { } impl Command { - fn execute(self, urls: UrlMap, settings: Settings) { + fn execute(self, urls: UrlMap, settings: Settings) { match self { Command::MakeMigrations(command) => command.execute(urls, settings), Command::Migrate(command) => command.execute(urls, settings), @@ -23,7 +23,7 @@ impl Command { } } -pub fn main(urls: UrlMap, settings: Settings) { +pub fn main(urls: UrlMap, settings: Settings) { let command = Command::from_args(); command.execute(urls, settings); } diff --git a/src/cli/run_server.rs b/src/cli/run_server.rs index d20ac14..242c824 100644 --- a/src/cli/run_server.rs +++ b/src/cli/run_server.rs @@ -1,6 +1,6 @@ use structopt::StructOpt; -use crate::{db::backend::Connectable, Settings, UrlMap}; +use crate::{Settings, UrlMap}; #[derive(StructOpt)] /// Run an HTTP server @@ -11,7 +11,7 @@ pub struct RunServer { } impl RunServer { - pub fn execute(self, urls: UrlMap, _settings: Settings) { + pub fn execute(self, urls: UrlMap, _settings: Settings) { println!("Starting server at http://127.0.0.1:{}/", self.port); let server_task = warp::serve(urls).run(([127, 0, 0, 1], self.port)); -- cgit v1.2.3