Use IntoValue in config code (#13751)

# Description

Cleans up and refactors the config code using the `IntoValue` macro.
Shoutout to @cptpiepmatz for making the macro!

# User-Facing Changes

Should be none.

# After Submitting

Somehow refactor the reverse transformation.
This commit is contained in:
Ian Manske
2024-09-05 00:44:23 -07:00
committed by GitHub
parent 4792328d0e
commit abd230e12e
37 changed files with 992 additions and 1206 deletions

View File

@ -55,7 +55,7 @@ impl Command for History {
HistoryFileFormat::Sqlite => {
history_path.push("history.sqlite3");
}
HistoryFileFormat::PlainText => {
HistoryFileFormat::Plaintext => {
history_path.push("history.txt");
}
}
@ -75,7 +75,7 @@ impl Command for History {
.ok()
}
HistoryFileFormat::PlainText => FileBackedHistory::with_file(
HistoryFileFormat::Plaintext => FileBackedHistory::with_file(
history.max_size as usize,
history_path.clone().into(),
)
@ -87,7 +87,7 @@ impl Command for History {
};
match history.file_format {
HistoryFileFormat::PlainText => Ok(history_reader
HistoryFileFormat::Plaintext => Ok(history_reader
.and_then(|h| {
h.search(SearchQuery::everything(SearchDirection::Forward, None))
.ok()