insta icon indicating copy to clipboard operation
insta copied to clipboard

Allow non-vec filters

Open konstin opened this issue 2 years ago • 1 comments

Filters such as

    insta::with_settings!({
        filters => vec![
            (r"\d+(ms|s)", "[TIME]"),
        ]
    }, {
        assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
            .arg("compile")
            .arg("input.txt")
    });

currently require a Vec: https://github.com/mitsuhiko/insta/blob/324cd7154a2f5e4b5198747049202f69305c2ac5/src/filters.rs#L12-L20 Could this requirement be lifted to allow slices or any iterable? I'd like to use e.g.

    insta::with_settings!({
        filters => INSTA_FILTERS
    }, {
        assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
            .arg("compile")
            .arg("input.txt")
    });

konstin avatar Nov 01 '23 13:11 konstin

There is a PR open for it, but I haven't had the courage yet to make the change. #400

mitsuhiko avatar Nov 05 '23 22:11 mitsuhiko

Closed by 1d70238

max-sixty avatar Apr 16 '24 18:04 max-sixty