Skip to content

Commit

Permalink
Shorten PR 1533 using std::Cow::Borrowed (#1537)
Browse files Browse the repository at this point in the history
* Shorten PR 1533 using std::Cow::Borrowed

1533 got auto-merged too quickly!

* moo
  • Loading branch information
jcjones authored Jan 28, 2025
1 parent c00f4c2 commit bcab5a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/entity/task/new_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
use rand::Rng;
use sea_orm::{ColumnTrait, ConnectionTrait, EntityTrait, QueryFilter};
use sha2::{Digest, Sha256};
use std::borrow::Cow;
use validator::{ValidationErrors, ValidationErrorsKind};
use vdaf::{DpStrategy, DpStrategyKind, SumVec};

Expand Down Expand Up @@ -282,7 +283,7 @@ impl NewTask {
Err(e) => {
let errors = errors
.errors_mut()
.entry(std::borrow::Cow::Borrowed("vdaf"))
.entry(Cow::Borrowed("vdaf"))
.or_insert_with(|| {
ValidationErrorsKind::Struct(Box::new(ValidationErrors::new()))
});
Expand All @@ -299,7 +300,7 @@ impl NewTask {
if !leader.vdafs.contains(&name) || !helper.vdafs.contains(&name) {
let errors = errors
.errors_mut()
.entry(std::borrow::Cow::Borrowed("vdaf"))
.entry(Cow::Borrowed("vdaf"))
.or_insert_with(|| ValidationErrorsKind::Struct(Box::new(ValidationErrors::new())));
match errors {
ValidationErrorsKind::Struct(errors) => {
Expand Down

0 comments on commit bcab5a8

Please sign in to comment.