Run cargo fmt on the project

IDE Action on Save seemed to be messing with the ordering.
This commit is contained in:
Lonami Exo 2022-10-20 20:06:22 +02:00
parent 0919c4a13c
commit cd37c5aa14
2 changed files with 17 additions and 20 deletions

View File

@ -1,13 +1,11 @@
use std::net::IpAddr;
use sqlite::{Connection, Error, State};
use model::Session;
use utils::{fetch_many, fetch_one};
mod model; mod model;
mod utils; mod utils;
use model::Session;
use sqlite::{Connection, Error, State};
use std::net::IpAddr;
use utils::{fetch_many, fetch_one};
fn init_schema(conn: &Connection) -> Result<(), Error> { fn init_schema(conn: &Connection) -> Result<(), Error> {
let version = match fetch_one(&conn, "SELECT version FROM version LIMIT 1", |stmt| { let version = match fetch_one(&conn, "SELECT version FROM version LIMIT 1", |stmt| {
stmt.read::<i64>(0) stmt.read::<i64>(0)
@ -92,7 +90,7 @@ pub fn create_session(conn: &Connection) -> Result<Session, Error> {
let id = fetch_one(conn, "SELECT LAST_INSERT_ROWID()", |stmt| { let id = fetch_one(conn, "SELECT LAST_INSERT_ROWID()", |stmt| {
stmt.read::<i64>(0) stmt.read::<i64>(0)
})? })?
.unwrap(); .unwrap();
Ok(Session { Ok(Session {
id, id,
user_id: None, user_id: None,

View File

@ -1,34 +1,33 @@
#![cfg(target_os = "android")] #![cfg(target_os = "android")]
#![allow(non_snake_case)] #![allow(non_snake_case)]
use std::collections::HashMap; mod db;
use std::ffi::{CStr, CString};
use std::future::Future;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::net::SocketAddr;
use std::sync::Mutex;
use grammers_client::{Client, Config};
use grammers_client::types::{Dialog, LoginToken}; use grammers_client::types::{Dialog, LoginToken};
use grammers_client::{Client, Config};
use grammers_session::{PackedChat, Session, UpdateState}; use grammers_session::{PackedChat, Session, UpdateState};
use jni::JNIEnv;
use jni::objects::{JObject, JString}; use jni::objects::{JObject, JString};
use jni::sys::{jboolean, jint, jlong, jstring}; use jni::sys::{jboolean, jint, jlong, jstring};
use jni::JNIEnv;
use log; use log;
use log::{error, info, Level}; use log::{error, info, Level};
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use std::collections::HashMap;
use std::ffi::{CStr, CString};
use std::future::Future;
use std::net::SocketAddr;
use std::net::{Ipv4Addr, Ipv6Addr};
use std::sync::Mutex;
use tokio::runtime; use tokio::runtime;
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
mod db; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
const LOG_MIN_LEVEL: Level = Level::Trace; const LOG_MIN_LEVEL: Level = Level::Trace;
const LOG_TAG: &str = ".native.talari"; const LOG_TAG: &str = ".native.talari";
const API_ID: i32 = 0; const API_ID: i32 = 0;
const API_HASH: &str = ""; const API_HASH: &str = "";
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
static RUNTIME: OnceCell<Runtime> = OnceCell::new(); static RUNTIME: OnceCell<Runtime> = OnceCell::new();
static CLIENT: OnceCell<Client> = OnceCell::new(); static CLIENT: OnceCell<Client> = OnceCell::new();
static DATABASE: Mutex<Option<sqlite::Connection>> = Mutex::new(None); static DATABASE: Mutex<Option<sqlite::Connection>> = Mutex::new(None);
@ -104,7 +103,7 @@ async fn init_client() -> Result<()> {
api_hash: API_HASH.to_string(), api_hash: API_HASH.to_string(),
params: Default::default(), params: Default::default(),
}) })
.await?; .await?;
info!("Connected!"); info!("Connected!");