Skip to content

Commit 05c4185

Browse files
committed
Remove an unnecessary clone
1 parent e8ff196 commit 05c4185

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ macro_rules! make_errors(
2626

2727
impl SqlState {
2828
#[doc(hidden)]
29-
pub fn from_code(s: &str) -> SqlState {
30-
match STATE_MAP.get(s) {
29+
pub fn from_code(s: String) -> SqlState {
30+
match STATE_MAP.get(&*s) {
3131
Some(state) => state.clone(),
32-
None => SqlState::Unknown(s.into_string())
32+
None => SqlState::Unknown(s)
3333
}
3434
}
3535
}
@@ -529,7 +529,7 @@ impl DbError {
529529
let mut map: HashMap<_, _> = fields.into_iter().collect();
530530
Ok(DbError {
531531
severity: try!(map.remove(&b'S').ok_or(())),
532-
code: SqlState::from_code(&*try!(map.remove(&b'C').ok_or(()))),
532+
code: SqlState::from_code(try!(map.remove(&b'C').ok_or(()))),
533533
message: try!(map.remove(&b'M').ok_or(())),
534534
detail: map.remove(&b'D'),
535535
hint: map.remove(&b'H'),

0 commit comments

Comments
 (0)