Switch some .to_string to .into_string

This commit is contained in:
Steven Fackler 2014-10-18 11:17:12 -07:00
parent e73557cce0
commit 86bf3b719b
4 changed files with 11 additions and 11 deletions

View File

@ -37,7 +37,7 @@ fn main() {
)", []).unwrap();
let me = Person {
id: 0,
name: "Steven".to_string(),
name: "Steven".into_string(),
time_created: time::get_time(),
data: None
};

View File

@ -29,7 +29,7 @@ macro_rules! make_errors(
pub fn from_code(s: &str) -> PostgresSqlState {
match STATE_MAP.find_equiv(&s) {
Some(state) => state.clone(),
None => UnknownSqlState(s.to_string())
None => UnknownSqlState(s.into_string())
}
}
}

View File

@ -29,7 +29,7 @@
//! )", []).unwrap();
//! let me = Person {
//! id: 0,
//! name: "Steven".to_string(),
//! name: "Steven".into_string(),
//! time_created: time::get_time(),
//! data: None
//! };
@ -237,7 +237,7 @@ impl IntoConnectParams for Url {
let database = if !path.is_empty() {
// path contains the leading /
let (_, path) = path[].slice_shift_char();
Some(path.to_string())
Some(path.into_string())
} else {
None
};
@ -395,14 +395,14 @@ impl InnerPostgresConnection {
canary: CANARY,
};
options.push(("client_encoding".to_string(), "UTF8".to_string()));
options.push(("client_encoding".into_string(), "UTF8".into_string()));
// Postgres uses the value of TimeZone as the time zone for TIMESTAMP
// WITH TIME ZONE values. Timespec converts to GMT internally.
options.push(("TimeZone".to_string(), "GMT".to_string()));
options.push(("TimeZone".into_string(), "GMT".into_string()));
// We have to clone here since we need the user again for auth
options.push(("user".to_string(), user.user.clone()));
options.push(("user".into_string(), user.user.clone()));
match database {
Some(database) => options.push(("database".to_string(), database)),
Some(database) => options.push(("database".into_string(), database)),
None => {}
}
@ -753,7 +753,7 @@ impl PostgresConnection {
/// target: TargetUnix(some_crazy_path),
/// port: None,
/// user: Some(PostgresUserInfo {
/// user: "postgres".to_string(),
/// user: "postgres".into_string(),
/// password: None
/// }),
/// database: None,
@ -827,7 +827,7 @@ impl PostgresConnection {
/// )", []));
///
/// let stmt = try!(conn.prepare_copy_in("foo", ["bar", "baz"]));
/// let data: &[&[&ToSql]] = &[&[&0i32, &"blah".to_string()],
/// let data: &[&[&ToSql]] = &[&[&0i32, &"blah".into_string()],
/// &[&1i32, &None::<String>]];
/// try!(stmt.execute(data.iter().map(|r| r.iter().map(|&e| e))));
/// # Ok(()) };

View File

@ -95,7 +95,7 @@ macro_rules! make_postgres_type(
match oid {
$($oid => $variant,)+
// We have to load an empty string now, it'll get filled in later
oid => PgUnknownType { name: "".to_string(), oid: oid }
oid => PgUnknownType { name: String::new(), oid: oid }
}
}