From e3e90430f44fb2a82eaf8c8f5053d85947dd8151 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Sun, 16 May 2021 16:52:10 +0200 Subject: [PATCH] Remove `File::toml` and `File::yaml` The added convenience is minimal over `new`, so I'd rather have a smaller API and less code with `#[cfg]`. --- src/file.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/file.rs b/src/file.rs index 93829c1..72e4f4f 100644 --- a/src/file.rs +++ b/src/file.rs @@ -35,6 +35,7 @@ pub struct File { } impl File { + /// Creates an optional file source. pub fn new(path: impl Into, format: FileFormat) -> Self { Self { path: path.into(), @@ -43,16 +44,6 @@ impl File { } } - #[cfg(feature = "toml")] - pub fn toml(path: impl Into) -> Self { - Self::new(path, FileFormat::Toml) - } - - #[cfg(feature = "yaml")] - pub fn yaml(path: impl Into) -> Self { - Self::new(path, FileFormat::Yaml) - } - /// Marks this file as required, meaning that `>::load` /// will return an error if the file does not exist. Otherwise, an empty /// layer (all values are `None`) is returned.