Skip to content

Config::load_or_default() is disliked by Clippy #3

@piccoloser

Description

@piccoloser

This is how the examples currently recommend formatting Config::load_or_default():

Config::load_or_default(CONFIG_INI, || {
    return sectioned_defaults! {
    // ...
    };
})

Clippy recommends removing the unneeded return statement. Doing so, however, leads to errors because sectioned_defaults! and general_defaults! don't return anything. The only other option that isn't flagged by Clippy is formatting the closure this way:

Config::load_or_default(CONFIG_INI, || sectioned_defaults! {
    // ...
})

However, running cargo fmt changes it to this:

// Does not compile
Config::load_or_default(CONFIG_INI, || {
    sectioned_defaults! {
        // ...
    }
})

This adds curly braces around the macro and breaks the function execution immediately.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions