Don't need to pass back the input here

This commit is contained in:
David Tolnay
2017-02-25 11:31:00 -08:00
parent 17279e8a4f
commit 47efbc6d75
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -168,12 +168,12 @@ impl Item {
// Parse `#[serde(rename_all="foo")]`
MetaItem(NameValue(ref name, ref lit)) if name == "rename_all" => {
if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) {
match RenameRule::from_str(s.as_str()) {
match RenameRule::from_str(&s) {
Ok(rename_rule) => rename_all.set(rename_rule),
Err(other) => {
Err(()) => {
cx.error(format!("unknown rename rule for #[serde(rename_all \
= {:?})]",
other))
s))
}
}
}
@@ -412,12 +412,12 @@ impl Variant {
// Parse `#[serde(rename_all="foo")]`
MetaItem(NameValue(ref name, ref lit)) if name == "rename_all" => {
if let Ok(s) = get_string_from_lit(cx, name.as_ref(), name.as_ref(), lit) {
match RenameRule::from_str(s.as_str()) {
match RenameRule::from_str(&s) {
Ok(rename_rule) => rename_all.set(rename_rule),
Err(other) => {
Err(()) => {
cx.error(format!("unknown rename rule for #[serde(rename_all \
= {:?})]",
other))
s))
}
}
}
+2 -2
View File
@@ -68,7 +68,7 @@ impl RenameRule {
}
impl FromStr for RenameRule {
type Err = String;
type Err = ();
fn from_str(rename_all_str: &str) -> Result<Self, Self::Err> {
match rename_all_str {
@@ -77,7 +77,7 @@ impl FromStr for RenameRule {
"snake_case" => Ok(SnakeCase),
"SCREAMING_SNAKE_CASE" => Ok(ScreamingSnakeCase),
"kebab-case" => Ok(KebabCase),
other => Err(other.to_string()),
_ => Err(()),
}
}
}