Remove unstable options from rustfmt.toml
This commit is contained in:
parent
6bf85ca664
commit
bc44cc23ae
|
@ -1,8 +1,4 @@
|
|||
newline_style = "Unix"
|
||||
max_width = 140
|
||||
tab_spaces = 2
|
||||
imports_layout = "Horizontal"
|
||||
merge_imports = true
|
||||
struct_field_align_threshold = 25
|
||||
where_single_line = true
|
||||
edition = "2018"
|
||||
|
|
|
@ -18,9 +18,7 @@ impl Error {
|
|||
|
||||
impl de::Error for Error {
|
||||
fn custom<T: Display>(msg: T) -> Self {
|
||||
Error {
|
||||
message: msg.to_string(),
|
||||
}
|
||||
Error { message: msg.to_string() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,20 +158,26 @@ mod helpers {
|
|||
/// Deserialize time from an integer that represents the seconds.
|
||||
/// mpd uses int for the database stats (e.g. total time played).
|
||||
pub fn de_time_int<'de, D>(deserializer: D) -> Result<Duration, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
u64::deserialize(deserializer).map(Duration::from_secs)
|
||||
}
|
||||
|
||||
/// Deserialize time from a float that represents the seconds.
|
||||
/// mpd uses floats for the current status (e.g. time elapsed in song).
|
||||
pub fn de_time_float<'de, D>(deserializer: D) -> Result<Option<Duration>, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
f64::deserialize(deserializer).map(Duration::from_secs_f64).map(Some)
|
||||
}
|
||||
|
||||
/// Deserialize the playback state.
|
||||
pub fn de_state<'de, D>(deserializer: D) -> Result<State, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
match String::deserialize(deserializer)?.as_ref() {
|
||||
"play" => Ok(State::Play),
|
||||
"pause" => Ok(State::Pause),
|
||||
|
@ -184,14 +190,18 @@ mod helpers {
|
|||
}
|
||||
|
||||
pub fn de_string_or_vec<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
String::deserialize(deserializer).map(|s| s.split(SEPARATOR).map(std::string::String::from).collect())
|
||||
}
|
||||
|
||||
/// mpd uses bints (0 or 1) to represent booleans,
|
||||
/// so we need a special parser for those.
|
||||
pub fn de_bint<'de, D>(deserializer: D) -> Result<bool, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
match u8::deserialize(deserializer)? {
|
||||
0 => Ok(false),
|
||||
1 => Ok(true),
|
||||
|
@ -202,7 +212,9 @@ mod helpers {
|
|||
/// Deserialize a position with an optional total length.
|
||||
/// The input string here is either a number or two numbers separated by `SEPARATOR`.
|
||||
pub fn de_position<'de, D>(deserializer: D) -> Result<Option<Position>, D::Error>
|
||||
where D: de::Deserializer<'de> {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
let s = String::deserialize(deserializer)?;
|
||||
let mut ints = s.split(SEPARATOR).filter_map(|s| u16::from_str(s).ok());
|
||||
if let Some(n) = ints.next() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user