Skip to content

Commit

Permalink
refactor: apply Clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Aug 23, 2024
1 parent 3e968c1 commit ae8a30a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 74 deletions.
144 changes: 72 additions & 72 deletions dprint_plugin/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "directives.comma".into(),
message: "invalid value for config `directives.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand All @@ -134,17 +134,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "enumValuesDefinition.comma".into(),
message: "invalid value for config `enumValuesDefinition.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand All @@ -154,17 +154,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "fieldsDefinition.comma".into(),
message: "invalid value for config `fieldsDefinition.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand All @@ -174,17 +174,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "inputFieldsDefinition.comma".into(),
message: "invalid value for config `inputFieldsDefinition.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand Down Expand Up @@ -232,17 +232,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "schemaDefinition.comma".into(),
message: "invalid value for config `schemaDefinition.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand All @@ -252,17 +252,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "schemaExtension.comma".into(),
message: "invalid value for config `schemaExtension.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand All @@ -272,17 +272,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"always" => Some(Comma::Always),
"never" => Some(Comma::Never),
"noTrailing" => Some(Comma::NoTrailing),
"onlySingleLine" => Some(Comma::OnlySingleLine),
.map(|option_value| match option_value {
"always" => Comma::Always,
"never" => Comma::Never,
"noTrailing" => Comma::NoTrailing,
"onlySingleLine" => Comma::OnlySingleLine,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "selectionSet.comma".into(),
message: "invalid value for config `selectionSet.comma`".into(),
});
Some(Comma::Never)
Comma::Never
}
})
.or(Some(Comma::Never)),
Expand Down Expand Up @@ -400,17 +400,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "enumValuesDefinition.singleLine".into(),
message: "invalid value for config `enumValuesDefinition.singleLine`"
.into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand All @@ -420,16 +420,16 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "fieldsDefinition.singleLine".into(),
message: "invalid value for config `fieldsDefinition.singleLine`".into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand Down Expand Up @@ -458,17 +458,17 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "inputFieldsDefinition.singleLine".into(),
message: "invalid value for config `inputFieldsDefinition.singleLine`"
.into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand Down Expand Up @@ -514,16 +514,16 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "schemaDefinition.singleLine".into(),
message: "invalid value for config `schemaDefinition.singleLine`".into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand All @@ -533,16 +533,16 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "schemaExtension.singleLine".into(),
message: "invalid value for config `schemaExtension.singleLine`".into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand All @@ -552,16 +552,16 @@ pub(crate) fn resolve_config(
&mut diagnostics,
)
.as_deref()
.and_then(|option_value| match option_value {
"prefer" => Some(SingleLine::Prefer),
"smart" => Some(SingleLine::Smart),
"never" => Some(SingleLine::Never),
.map(|option_value| match option_value {
"prefer" => SingleLine::Prefer,
"smart" => SingleLine::Smart,
"never" => SingleLine::Never,
_ => {
diagnostics.push(ConfigurationDiagnostic {
property_name: "selectionSet.singleLine".into(),
message: "invalid value for config `selectionSet.singleLine`".into(),
});
Some(SingleLine::Never)
SingleLine::Never
}
})
.or(Some(SingleLine::Never)),
Expand Down
4 changes: 2 additions & 2 deletions pretty_graphql/tests/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn fmt_snapshot() {
}

fn run_format_test(path: &Path, input: &str, options: &FormatOptions) -> String {
let output = format_text(&input, &options)
let output = format_text(input, options)
.map_err(|err| format!("failed to format '{}': {:?}", path.display(), err))
.unwrap();

Expand All @@ -53,7 +53,7 @@ fn run_format_test(path: &Path, input: &str, options: &FormatOptions) -> String
path.display()
);

let regression_format = format_text(&output, &options)
let regression_format = format_text(&output, options)
.map_err(|err| {
format!(
"syntax error in stability test '{}': {:?}",
Expand Down

0 comments on commit ae8a30a

Please sign in to comment.