Prefer '.clone_from' over mutating a clone.
Clippy says it's more efficient. I trust clippy. Clippy good.
This commit is contained in:
parent
ea3e79c132
commit
7ff6eba869
|
@ -3918,7 +3918,7 @@ impl<'a> CodeGenerator<'a> {
|
||||||
.map(|(_, tipo)| get_generic_variant_name(tipo))
|
.map(|(_, tipo)| get_generic_variant_name(tipo))
|
||||||
.join("");
|
.join("");
|
||||||
|
|
||||||
*variant_name = variant.clone();
|
variant_name.clone_from(&variant);
|
||||||
|
|
||||||
if !dependency_functions
|
if !dependency_functions
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use chumsky::prelude::*;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast,
|
ast,
|
||||||
parser::{annotation, error::ParseError, token::Token, utils},
|
parser::{annotation, error::ParseError, token::Token, utils},
|
||||||
};
|
};
|
||||||
|
use chumsky::prelude::*;
|
||||||
|
|
||||||
pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError> {
|
pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError> {
|
||||||
let unlabeled_constructor_type_args = annotation()
|
let unlabeled_constructor_type_args = annotation()
|
||||||
|
@ -67,7 +66,7 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|mut constructor| {
|
.map(|mut constructor| {
|
||||||
if constructor.sugar {
|
if constructor.sugar {
|
||||||
constructor.name = name.clone();
|
constructor.name.clone_from(&name);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor
|
constructor
|
||||||
|
|
|
@ -1150,7 +1150,7 @@ impl Error {
|
||||||
rigid_type_names: ref mut annotated_names,
|
rigid_type_names: ref mut annotated_names,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
*annotated_names = new_names.clone();
|
annotated_names.clone_from(new_names);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
_ => self,
|
_ => self,
|
||||||
|
|
Loading…
Reference in New Issue