Merge pull request #40 from diwic/patch-1

Change "".to_string() to String::new()
pull/45/head
Chris Wong 8 years ago committed by GitHub
commit 3c68655fab

@ -29,7 +29,7 @@ fn a_to_b(e: &mut MyEnum) {
// (note that empty strings don't allocate).
// Then, construct the new enum variant (which will
// be assigned to `*e`, because it is the result of the `if let` expression).
MyEnum::B { name: mem::replace(name, "".to_string()) }
MyEnum::B { name: mem::replace(name, String::new()) }
// In all other cases, we return immediately, thus skipping the assignment
} else { return }

Loading…
Cancel
Save