Rename to_str() -> as_str() to match stdlib naming convention

The function does a cast and does not create a new objects.  The
stdlib convention is to use to_*() for functions which return new
objects and as_*() for functions which keep referring to the same data
but using a different type.  Follow that convention.
This commit is contained in:
Floris Bruynooghe
2019-06-07 22:08:49 +02:00
parent 18c0d9f83b
commit 855c7844b5
19 changed files with 84 additions and 84 deletions

View File

@@ -7,7 +7,7 @@ use crate::constants::*;
use crate::context::Context;
use crate::dc_loginparam::*;
use crate::dc_sqlite3::*;
use crate::dc_tools::{to_str, to_string};
use crate::dc_tools::{as_str, to_string};
use crate::oauth2::dc_get_oauth2_access_token;
use crate::types::*;
@@ -521,11 +521,11 @@ impl Imap {
}
{
let addr = to_str(lp.addr);
let imap_server = to_str(lp.mail_server);
let addr = as_str(lp.addr);
let imap_server = as_str(lp.mail_server);
let imap_port = lp.mail_port as u16;
let imap_user = to_str(lp.mail_user);
let imap_pw = to_str(lp.mail_pw);
let imap_user = as_str(lp.mail_user);
let imap_pw = as_str(lp.mail_pw);
let server_flags = lp.server_flags as usize;
let mut config = self.config.write().unwrap();
@@ -695,7 +695,7 @@ impl Imap {
if val1.is_null() {
return (0, 0);
}
let entry = to_str(val1);
let entry = as_str(val1);
// the entry has the format `imap.mailbox.<folder>=<uidvalidity>:<lastseenuid>`
let mut parts = entry.split(':');