Skip to content

Commit

Permalink
use std::mem::take to avoid clone
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Mar 25, 2024
1 parent 1fee6b7 commit 1fd187f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cmd/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
match rdr.read_record(&mut batch_record) {
Ok(has_data) => {
if has_data {
batch.push(batch_record.clone());
batch.push(std::mem::take(&mut batch_record));
} else {
// nothing else to add to batch
break;
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/applydp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
match rdr.read_record(&mut batch_record) {
Ok(has_data) => {
if has_data {
batch.push(batch_record.clone());
batch.push(std::mem::take(&mut batch_record));
} else {
// nothing else to add to batch
break;
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/datefmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
match rdr.read_record(&mut batch_record) {
Ok(has_data) => {
if has_data {
batch.push(batch_record.clone());
batch.push(std::mem::take(&mut batch_record));
} else {
// nothing else to add to batch
break;
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/geocode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ async fn geocode_main(args: Args) -> CliResult<()> {
match rdr.read_record(&mut batch_record) {
Ok(has_data) => {
if has_data {
batch.push(batch_record.clone());
batch.push(std::mem::take(&mut batch_record));
} else {
// nothing else to add to batch
break;
Expand Down

0 comments on commit 1fd187f

Please sign in to comment.