Prevent duplicate monomorphization of deserialization impls
This reduces binary size from 9.7MiB (5.8MiB for just rustbuild code) to 9.3MiB (5.3MiB for just rustbuild code). This doesn't reduce compile time in a statistically significant way.
This commit is contained in:
parent
a0b4d2136d
commit
dca8ff5b25
@ -731,7 +731,11 @@ impl Config {
|
||||
|
||||
let contents =
|
||||
t!(fs::read_to_string(file), format!("config file {} not found", file.display()));
|
||||
match toml::from_str(&contents) {
|
||||
// Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
|
||||
// TomlConfig and sub types to be monomorphized 5x by toml.
|
||||
match toml::from_str(&contents)
|
||||
.and_then(|table: toml::Value| TomlConfig::deserialize(table))
|
||||
{
|
||||
Ok(table) => table,
|
||||
Err(err) => {
|
||||
println!("failed to parse TOML configuration '{}': {}", file.display(), err);
|
||||
|
Loading…
x
Reference in New Issue
Block a user