Navigation Menu

Skip to content

Commit

Permalink
Change deref for asref
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Sanchez Quiros committed Jul 28, 2021
1 parent 62d2f7a commit 4deb9f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ideascale/mod.rs
Expand Up @@ -86,7 +86,7 @@ pub async fn fetch_all(fund: usize, api_token: String) -> Result<IdeaScaleData,
funnels,
fund: funds
.into_iter()
.find(|f| f.name.contains(&format!("Fund{}", fund)))
.find(|f| f.name.as_ref().contains(&format!("Fund{}", fund)))
.unwrap_or_else(|| panic!("Selected fund {}, wasn't among the available funds", fund)),
challenges: challenges.into_iter().map(|c| (c.id, c)).collect(),
proposals: proposals.into_iter().map(|p| (p.proposal_id, p)).collect(),
Expand Down
9 changes: 3 additions & 6 deletions src/ideascale/models/de.rs
Expand Up @@ -2,7 +2,6 @@ use serde::de::Error;
use serde::{Deserialize, Deserializer};

use std::collections::HashSet;
use std::ops::Deref;

lazy_static::lazy_static! {
static ref DIRTY_CHARACTERS: HashSet<char> = ['*', '-', '/'].iter().copied().collect();
Expand Down Expand Up @@ -97,7 +96,7 @@ pub struct CleanString(#[serde(deserialize_with = "deserialize_clean_string")] S

impl Funnel {
pub fn is_community(&self) -> bool {
self.title.contains("Challenge Setting")
self.title.as_ref().contains("Challenge Setting")
}
}

Expand All @@ -107,10 +106,8 @@ impl ToString for CleanString {
}
}

impl Deref for CleanString {
type Target = String;

fn deref(&self) -> &Self::Target {
impl AsRef<str> for CleanString {
fn as_ref(&self) -> &str {
&self.0
}
}
Expand Down

0 comments on commit 4deb9f8

Please sign in to comment.