Skip to content

Commit 86bf3b7

Browse files
committed
Switch some .to_string to .into_string
1 parent e73557c commit 86bf3b7

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
)", []).unwrap();
3838
let me = Person {
3939
id: 0,
40-
name: "Steven".to_string(),
40+
name: "Steven".into_string(),
4141
time_created: time::get_time(),
4242
data: None
4343
};

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! make_errors(
2929
pub fn from_code(s: &str) -> PostgresSqlState {
3030
match STATE_MAP.find_equiv(&s) {
3131
Some(state) => state.clone(),
32-
None => UnknownSqlState(s.to_string())
32+
None => UnknownSqlState(s.into_string())
3333
}
3434
}
3535
}

src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! )", []).unwrap();
3030
//! let me = Person {
3131
//! id: 0,
32-
//! name: "Steven".to_string(),
32+
//! name: "Steven".into_string(),
3333
//! time_created: time::get_time(),
3434
//! data: None
3535
//! };
@@ -237,7 +237,7 @@ impl IntoConnectParams for Url {
237237
let database = if !path.is_empty() {
238238
// path contains the leading /
239239
let (_, path) = path[].slice_shift_char();
240-
Some(path.to_string())
240+
Some(path.into_string())
241241
} else {
242242
None
243243
};
@@ -395,14 +395,14 @@ impl InnerPostgresConnection {
395395
canary: CANARY,
396396
};
397397

398-
options.push(("client_encoding".to_string(), "UTF8".to_string()));
398+
options.push(("client_encoding".into_string(), "UTF8".into_string()));
399399
// Postgres uses the value of TimeZone as the time zone for TIMESTAMP
400400
// WITH TIME ZONE values. Timespec converts to GMT internally.
401-
options.push(("TimeZone".to_string(), "GMT".to_string()));
401+
options.push(("TimeZone".into_string(), "GMT".into_string()));
402402
// We have to clone here since we need the user again for auth
403-
options.push(("user".to_string(), user.user.clone()));
403+
options.push(("user".into_string(), user.user.clone()));
404404
match database {
405-
Some(database) => options.push(("database".to_string(), database)),
405+
Some(database) => options.push(("database".into_string(), database)),
406406
None => {}
407407
}
408408

@@ -753,7 +753,7 @@ impl PostgresConnection {
753753
/// target: TargetUnix(some_crazy_path),
754754
/// port: None,
755755
/// user: Some(PostgresUserInfo {
756-
/// user: "postgres".to_string(),
756+
/// user: "postgres".into_string(),
757757
/// password: None
758758
/// }),
759759
/// database: None,
@@ -827,7 +827,7 @@ impl PostgresConnection {
827827
/// )", []));
828828
///
829829
/// let stmt = try!(conn.prepare_copy_in("foo", ["bar", "baz"]));
830-
/// let data: &[&[&ToSql]] = &[&[&0i32, &"blah".to_string()],
830+
/// let data: &[&[&ToSql]] = &[&[&0i32, &"blah".into_string()],
831831
/// &[&1i32, &None::<String>]];
832832
/// try!(stmt.execute(data.iter().map(|r| r.iter().map(|&e| e))));
833833
/// # Ok(()) };

src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ macro_rules! make_postgres_type(
9595
match oid {
9696
$($oid => $variant,)+
9797
// We have to load an empty string now, it'll get filled in later
98-
oid => PgUnknownType { name: "".to_string(), oid: oid }
98+
oid => PgUnknownType { name: String::new(), oid: oid }
9999
}
100100
}
101101

0 commit comments

Comments
 (0)