Prefer '.clone_from' over mutating a clone.

Clippy says it's more efficient. I trust clippy. Clippy good.
This commit is contained in:
KtorZ
2024-05-16 23:42:53 +02:00
parent ea3e79c132
commit 7ff6eba869
3 changed files with 4 additions and 5 deletions

View File

@@ -1,9 +1,8 @@
use chumsky::prelude::*;
use crate::{
ast,
parser::{annotation, error::ParseError, token::Token, utils},
};
use chumsky::prelude::*;
pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError> {
let unlabeled_constructor_type_args = annotation()
@@ -67,7 +66,7 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
.into_iter()
.map(|mut constructor| {
if constructor.sugar {
constructor.name = name.clone();
constructor.name.clone_from(&name);
}
constructor