chore: fix compiler warnings (mut + unused assignments) (#40)

* Stop allowing unused assignments

* test: remove unused assignments in cmdline

* chore: fix compiler warnings in dc_tools.rs

* chore: fix compiler warnings in dc_token.rs

* chore: fix compiler warnings in dc_strencode.rs

* chore: fix compiler warnings in dc_stock.rs

* chore: fix compiler warnings in dc_sqlite3.rs

* chore: fix compiler warnings in dc_simplify.rs

* chore: fix compiler warnings in dc_securejoin.rs

* chore: fix compiler warnings in dc_saxparser.rs

* chore: fix compiler warnings in dc_pgp.rs

* chore: fix compiler warnings in dc_param.rs

* chore: fix compiler warnings in dc_oauth2.rs

* chore: fix compiler warnings in dc_msg.rs

* chore: fix compiler warnings in dc_mimeparser.rs

* chore: fix compiler warnings in dc_mimefactory.rs

* chore: fix compiler warnings in dc_lot.rs

* chore: fix compiler warnings in dc_loginparams.rs

* chore: fix compiler warnings in dc_log.rs

* chore: fix compiler warnings in dc_location.rs

* chore: fix compiler warnings in dc_keyring.rs

* chore: fix compiler warnings in dc_key.rs

* chore: fix compiler warnings in dc_jsmn.rs

* chore: fix compiler warnings in dc_jobthread.rs

* chore: fix compiler warnings in dc_imex.rs

* chore: fix compiler warnings in dc_hash.rs

* chore: fix compiler warnings in dc_e2ee.rs

* chore: fix compiler warnings in dc_context.rs

* chore: fix compiler warnings in dc_contact.rs

* chore: fix compiler warnings in dc_chatlist.rs

* chore: fix compiler warnings in dc_chat.rs

* chore: fix compiler warnings in dc_array.rs

* chore: fix compiler warnings in dc_apeerstate.rs

* chore: fix compiler warnings in dc_aheader.rs

* chore: fix compiler warnings in dc_array.rs

* test: remove compiler warnings in test/stress.rs

* test: reduce compiler warnings in examples/repl/main.rs

* test: std:🧵:sleep_ms() is deprecated

* chore: remove unused variable in dc_sqlite3.rs

* chore: fix compiler warnings in dc_receive_imf.rs

* chore: fix compiler warnings in dc_job.rs

* chore: fix compiler warnings in dc_configure.rs

* Fix formatting
This commit is contained in:
Lars-Magnus Skog
2019-05-05 21:58:59 +02:00
committed by Friedel Ziegelmayer
parent 67f1d67de7
commit 2cf6cde5d1
40 changed files with 1635 additions and 888 deletions

View File

@@ -10,7 +10,6 @@ use crate::types::*;
use crate::x::*;
const DC_OPEN_READONLY: usize = 0x01;
const DC_HOUSEKEEPING_DELAY_SEC: usize = 10;
/// A simple wrapper around the underlying Sqlite3 object.
#[repr(C)]
@@ -900,7 +899,6 @@ pub unsafe fn dc_sqlite3_open(
b"ALTER TABLE locations ADD COLUMN independent INTEGER DEFAULT 0;\x00" as *const u8 as *const libc::c_char
);
dbversion = 55;
dc_sqlite3_set_config_int(
context,
sql,
@@ -1018,8 +1016,8 @@ pub unsafe fn dc_sqlite3_set_config(
key: *const libc::c_char,
value: *const libc::c_char,
) -> libc::c_int {
let mut state = 0;
let mut stmt = 0 as *mut sqlite3_stmt;
let mut state;
let mut stmt;
if key.is_null() {
dc_log_error(
context,
@@ -1135,7 +1133,7 @@ pub unsafe extern "C" fn dc_sqlite3_log_error(
msg_format: *const libc::c_char,
va: ...
) {
let mut msg = 0 as *mut libc::c_char;
let mut msg;
if msg_format.is_null() {
return;
}
@@ -1174,7 +1172,7 @@ pub unsafe fn dc_sqlite3_get_config(
key: *const libc::c_char,
def: *const libc::c_char,
) -> *mut libc::c_char {
let mut stmt = 0 as *mut sqlite3_stmt;
let mut stmt;
if 0 == dc_sqlite3_is_open(sql) || key.is_null() {
return dc_strdup_keep_null(def);
}
@@ -1202,7 +1200,7 @@ pub unsafe fn dc_sqlite3_execute(
querystr: *const libc::c_char,
) -> libc::c_int {
let mut success = 0;
let mut sqlState = 0;
let mut sqlState;
let stmt = dc_sqlite3_prepare(context, sql, querystr);
if !stmt.is_null() {
sqlState = sqlite3_step(stmt);
@@ -1262,7 +1260,7 @@ pub unsafe fn dc_sqlite3_table_exists(
) -> libc::c_int {
let mut ret = 0;
let mut stmt = 0 as *mut sqlite3_stmt;
let mut sqlState = 0;
let mut sqlState;
let querystr = sqlite3_mprintf(
b"PRAGMA table_info(%s)\x00" as *const u8 as *const libc::c_char,
@@ -1339,7 +1337,7 @@ pub unsafe fn dc_sqlite3_try_execute(
) -> libc::c_int {
// same as dc_sqlite3_execute() but does not pass error to ui
let mut success = 0;
let mut sql_state = 0;
let mut sql_state;
let stmt = dc_sqlite3_prepare(context, sql, querystr);
if !stmt.is_null() {
sql_state = sqlite3_step(stmt);
@@ -1416,9 +1414,9 @@ pub unsafe fn dc_sqlite3_get_rowid2(
}
pub unsafe fn dc_housekeeping(context: &dc_context_t) {
let mut stmt = 0 as *mut sqlite3_stmt;
let mut dir_handle = 0 as *mut DIR;
let mut dir_entry = 0 as *mut dirent;
let mut stmt;
let mut dir_handle;
let mut dir_entry;
let mut files_in_use = dc_hash_t {
keyClass: 0,
copyKey: 0,