| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#}; |
| 2 | |
| 3 | use craterust-analyzer cargo git-delta 0.19.2 crate/::clirust-analyzer cargo git-delta 0.19.2 cli/; |
| 4 | use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/; |
| 5 | use craterust-analyzer cargo git-delta 0.19.2 crate/::fatalrust-analyzer cargo git-delta 0.19.2 fatal().; |
| 6 | use craterust-analyzer cargo git-delta 0.19.2 crate/::git_configrust-analyzer cargo git-delta 0.19.2 git_config/::GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#; |
| 7 | use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/::{selfrust-analyzer cargo git-delta 0.19.2 style/, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#}; |
| 8 | |
| 9 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 10 | enum StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference# { |
| 11 | Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#), |
| 12 | Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 13 | } |
| 14 | |
| 15 | fn is_style_referencerust-analyzer cargo git-delta 0.19.2 parse_styles/is_style_reference().(style_string: &str) -> bool { |
| 16 | style_string.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().("-style") && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().style_string.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().' ') |
| 17 | } |
| 18 | |
| 19 | pub fn parse_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#> { |
| 20 | let mut styles: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 21 | |
| 22 | make_hunk_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_hunk_styles().(opt, &mut styles); |
| 23 | make_commit_file_hunk_header_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_commit_file_hunk_header_styles().(opt, &mut styles); |
| 24 | make_line_number_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_line_number_styles().(opt, &mut styles); |
| 25 | make_blame_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_blame_styles().(opt, &mut styles); |
| 26 | make_grep_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_grep_styles().(opt, &mut styles); |
| 27 | make_merge_conflict_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_merge_conflict_styles().(opt, &mut styles); |
| 28 | make_misc_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_misc_styles().(opt, &mut styles); |
| 29 | |
| 30 | let mut resolved_styles = resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/resolve_style_references().(styles, opt); |
| 31 | resolved_styles |
| 32 | .get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().("minus-emph-style") |
| 33 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("minus-emph-style not found in resolved styles")) |
| 34 | .is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph. = true; |
| 35 | |
| 36 | resolved_styles |
| 37 | .get_mutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get_mut().("plus-emph-style") |
| 38 | .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("plus-emph-style not found in resolved styles")) |
| 39 | .is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph. = true; |
| 40 | resolved_styles |
| 41 | } |
| 42 | |
| 43 | pub fn parse_styles_maprust-analyzer cargo git-delta 0.19.2 parse_styles/parse_styles_map().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<stylerust-analyzer cargo git-delta 0.19.2 style/::AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>> { |
| 44 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(styles_map_str) = &opt.map_stylesrust-analyzer cargo git-delta 0.19.2 cli/Opt#map_styles. { |
| 45 | let mut styles_map = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 46 | for pair_str in styles_map_str.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().(',') { |
| 47 | let mut style_strs = pair_str.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("=>").maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| s.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().()); |
| 48 | if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(from_str), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(to_str)) = (style_strs.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().(), style_strs.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]next().()) { |
| 49 | let from_style = parse_as_style_or_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_style_or_reference_to_git_config().(from_str, opt); |
| 50 | let to_style = parse_as_style_or_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_style_or_reference_to_git_config().(to_str, opt); |
| 51 | styles_map.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 52 | stylerust-analyzer cargo git-delta 0.19.2 style/::ansi_term_style_equality_keyrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality_key().(from_style.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.), |
| 53 | to_style, |
| 54 | ); |
| 55 | } |
| 56 | } |
| 57 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(styles_map) |
| 58 | } else { |
| 59 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | fn resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/resolve_style_references().( |
| 64 | edges: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>, |
| 65 | opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, |
| 66 | ) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#> { |
| 67 | let mut resolved_styles = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 68 | |
| 69 | for starting_node in edges.keysrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]keys().() { |
| 70 | if resolved_styles.contains_keyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]contains_key().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().starting_node) { |
| 71 | continue; |
| 72 | } |
| 73 | let mut visited = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().(); |
| 74 | let mut node = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().starting_node; |
| 75 | loop { |
| 76 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().visited.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(node) { |
| 77 | #[cfg(not(test))] |
| 78 | fatalrust-analyzer cargo git-delta 0.19.2 fatal().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Your delta styles form a cycle! {visited:?}")); |
| 79 | #[cfg(test)] |
| 80 | return [("__cycle__", Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().())] |
| 81 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 82 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (a.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b)) |
| 83 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 84 | } |
| 85 | match &edges.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&node) { |
| 86 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#(child_node)) => node = child_node, |
| 87 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style)) => { |
| 88 | resolved_styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().(visited.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|node| (node.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().style))); |
| 89 | break; |
| 90 | } |
| 91 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 92 | let style = parse_as_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_reference_to_git_config().(node, opt); |
| 93 | resolved_styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().(visited.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|node| (node.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), style))); |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | resolved_styles |
| 99 | } |
| 100 | |
| 101 | fn parse_as_style_or_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_style_or_reference_to_git_config().(style_string: &str, opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 102 | match style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().(style_string, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true, opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().()) { |
| 103 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#(style_ref) => parse_as_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_reference_to_git_config().(&style_ref, opt), |
| 104 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style) => style, |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | fn parse_as_reference_to_git_configrust-analyzer cargo git-delta 0.19.2 parse_styles/parse_as_reference_to_git_config().(style_string: &str, opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#) -> Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 109 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(git_config) = opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().() { |
| 110 | let git_config_key = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("delta.{style_string}"); |
| 111 | match git_config.getrust-analyzer cargo git-delta 0.19.2 git_config/impl#[GitConfig]get().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(&git_config_key) { |
| 112 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(&s), |
| 113 | _ => fatalrust-analyzer cargo git-delta 0.19.2 fatal().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 114 | "Style key not found in git config: {git_config_key}", |
| 115 | )), |
| 116 | } |
| 117 | } else { |
| 118 | fatalrust-analyzer cargo git-delta 0.19.2 fatal().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 119 | "Style not found (git config unavailable): {style_string}", |
| 120 | )); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | fn make_hunk_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_hunk_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 125 | let color_mode = opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..color_moderust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#color_mode.; |
| 126 | let true_color = opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color.; |
| 127 | let minus_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 128 | &opt.minus_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#minus_style., |
| 129 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 130 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 131 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_minus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_minus_background_color_default().( |
| 132 | color_mode, true_color, |
| 133 | )), |
| 134 | )), |
| 135 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 136 | true_color, |
| 137 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 138 | ); |
| 139 | |
| 140 | let minus_emph_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 141 | &opt.minus_emph_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#minus_emph_style., |
| 142 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 143 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 144 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_minus_emph_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_minus_emph_background_color_default().( |
| 145 | color_mode, true_color, |
| 146 | )), |
| 147 | )), |
| 148 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 149 | true_color, |
| 150 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 151 | ); |
| 152 | |
| 153 | let minus_non_emph_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 154 | &opt.minus_non_emph_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#minus_non_emph_style., |
| 155 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 156 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 157 | true_color, |
| 158 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 159 | ); |
| 160 | |
| 161 | // The style used to highlight a removed empty line when otherwise it would be invisible due to |
| 162 | // lack of background color in minus-style. |
| 163 | let minus_empty_line_marker_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 164 | &opt.minus_empty_line_marker_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#minus_empty_line_marker_style., |
| 165 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 166 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 167 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_minus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_minus_background_color_default().( |
| 168 | color_mode, true_color, |
| 169 | )), |
| 170 | )), |
| 171 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 172 | true_color, |
| 173 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 174 | ); |
| 175 | |
| 176 | let zero_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().(&opt.zero_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#zero_style., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true_color, opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().()); |
| 177 | |
| 178 | let plus_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 179 | &opt.plus_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#plus_style., |
| 180 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 181 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 182 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_plus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_plus_background_color_default().( |
| 183 | color_mode, true_color, |
| 184 | )), |
| 185 | )), |
| 186 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 187 | true_color, |
| 188 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 189 | ); |
| 190 | |
| 191 | let plus_emph_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 192 | &opt.plus_emph_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#plus_emph_style., |
| 193 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 194 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 195 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_plus_emph_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_plus_emph_background_color_default().( |
| 196 | color_mode, true_color, |
| 197 | )), |
| 198 | )), |
| 199 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 200 | true_color, |
| 201 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 202 | ); |
| 203 | |
| 204 | let plus_non_emph_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 205 | &opt.plus_non_emph_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#plus_non_emph_style., |
| 206 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 207 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 208 | true_color, |
| 209 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 210 | ); |
| 211 | |
| 212 | // The style used to highlight an added empty line when otherwise it would be invisible due to |
| 213 | // lack of background color in plus-style. |
| 214 | let plus_empty_line_marker_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 215 | &opt.plus_empty_line_marker_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#plus_empty_line_marker_style., |
| 216 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 217 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 218 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colorrust-analyzer cargo git-delta 0.19.2 color/::get_plus_background_color_defaultrust-analyzer cargo git-delta 0.19.2 color/get_plus_background_color_default().( |
| 219 | color_mode, true_color, |
| 220 | )), |
| 221 | )), |
| 222 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 223 | true_color, |
| 224 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 225 | ); |
| 226 | |
| 227 | let whitespace_error_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 228 | &opt.whitespace_error_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#whitespace_error_style., |
| 229 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 230 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 231 | true_color, |
| 232 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 233 | ); |
| 234 | |
| 235 | styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().([ |
| 236 | ("minus-style", minus_style), |
| 237 | ("minus-emph-style", minus_emph_style), |
| 238 | ("minus-non-emph-style", minus_non_emph_style), |
| 239 | ( |
| 240 | "minus-empty-line-marker-style", |
| 241 | minus_empty_line_marker_style, |
| 242 | ), |
| 243 | ("zero-style", zero_style), |
| 244 | ("plus-style", plus_style), |
| 245 | ("plus-emph-style", plus_emph_style), |
| 246 | ("plus-non-emph-style", plus_non_emph_style), |
| 247 | ("plus-empty-line-marker-style", plus_empty_line_marker_style), |
| 248 | ("whitespace-error-style", whitespace_error_style), |
| 249 | ]) |
| 250 | } |
| 251 | |
| 252 | fn make_line_number_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_line_number_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 253 | let true_color = opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color.; |
| 254 | let line_numbers_left_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 255 | &opt.line_numbers_left_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#line_numbers_left_style., |
| 256 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 257 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 258 | true_color, |
| 259 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 260 | ); |
| 261 | |
| 262 | let line_numbers_minus_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 263 | &opt.line_numbers_minus_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#line_numbers_minus_style., |
| 264 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 265 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 266 | true_color, |
| 267 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 268 | ); |
| 269 | |
| 270 | let line_numbers_zero_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 271 | &opt.line_numbers_zero_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#line_numbers_zero_style., |
| 272 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 273 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 274 | true_color, |
| 275 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 276 | ); |
| 277 | |
| 278 | let line_numbers_plus_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 279 | &opt.line_numbers_plus_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#line_numbers_plus_style., |
| 280 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 281 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 282 | true_color, |
| 283 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 284 | ); |
| 285 | |
| 286 | let line_numbers_right_style = style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 287 | &opt.line_numbers_right_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#line_numbers_right_style., |
| 288 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 289 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 290 | true_color, |
| 291 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 292 | ); |
| 293 | |
| 294 | styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().([ |
| 295 | ("line-numbers-minus-style", line_numbers_minus_style), |
| 296 | ("line-numbers-zero-style", line_numbers_zero_style), |
| 297 | ("line-numbers-plus-style", line_numbers_plus_style), |
| 298 | ("line-numbers-left-style", line_numbers_left_style), |
| 299 | ("line-numbers-right-style", line_numbers_right_style), |
| 300 | ]) |
| 301 | } |
| 302 | |
| 303 | fn make_commit_file_hunk_header_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_commit_file_hunk_header_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 304 | let true_color = opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color.; |
| 305 | styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().([ |
| 306 | ( |
| 307 | "commit-style", |
| 308 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 309 | &opt.commit_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#commit_style., |
| 310 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 311 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&opt.commit_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#commit_decoration_style.), |
| 312 | true_color, |
| 313 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 314 | ), |
| 315 | ), |
| 316 | ( |
| 317 | "file-style", |
| 318 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 319 | &opt.file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#file_style., |
| 320 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 321 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&opt.file_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#file_decoration_style.), |
| 322 | true_color, |
| 323 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 324 | ), |
| 325 | ), |
| 326 | ( |
| 327 | "classic-grep-header-style", |
| 328 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 329 | opt.hunk_header_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_style..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(), |
| 330 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 331 | opt.grep_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_header_decoration_style. |
| 332 | .as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().() |
| 333 | .orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(opt.hunk_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_decoration_style..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())), |
| 334 | true_color, |
| 335 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 336 | ), |
| 337 | ), |
| 338 | ( |
| 339 | "ripgrep-header-style", |
| 340 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 341 | "file", |
| 342 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 343 | opt.grep_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_header_decoration_style..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().().orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("none")), |
| 344 | true_color, |
| 345 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 346 | ), |
| 347 | ), |
| 348 | ( |
| 349 | "hunk-header-style", |
| 350 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 351 | &opt.hunk_header_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_style., |
| 352 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 353 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&opt.hunk_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_decoration_style.), |
| 354 | true_color, |
| 355 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 356 | ), |
| 357 | ), |
| 358 | ( |
| 359 | "hunk-header-file-style", |
| 360 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 361 | &opt.hunk_header_file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_file_style., |
| 362 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 363 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 364 | true_color, |
| 365 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 366 | ), |
| 367 | ), |
| 368 | ( |
| 369 | "classic-grep-header-file-style", |
| 370 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 371 | opt.grep_header_file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_header_file_style. |
| 372 | .as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().() |
| 373 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(opt.hunk_header_file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_file_style..as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()), |
| 374 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 375 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 376 | true_color, |
| 377 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 378 | ), |
| 379 | ), |
| 380 | ( |
| 381 | "ripgrep-header-file-style", |
| 382 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 383 | opt.grep_header_file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_header_file_style..as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().("magenta"), |
| 384 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 385 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 386 | true_color, |
| 387 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 388 | ), |
| 389 | ), |
| 390 | ( |
| 391 | "hunk-header-line-number-style", |
| 392 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 393 | &opt.hunk_header_line_number_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#hunk_header_line_number_style., |
| 394 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 395 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 396 | true_color, |
| 397 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 398 | ), |
| 399 | ), |
| 400 | ]); |
| 401 | } |
| 402 | |
| 403 | fn make_blame_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_blame_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 404 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(style_string) = &opt.blame_code_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#blame_code_style. { |
| 405 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 406 | "blame-code-style", |
| 407 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 408 | style_string, |
| 409 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 410 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 411 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 412 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 413 | ), |
| 414 | ); |
| 415 | }; |
| 416 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(style_string) = &opt.blame_separator_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#blame_separator_style. { |
| 417 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 418 | "blame-separator-style", |
| 419 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 420 | style_string, |
| 421 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 422 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 423 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 424 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 425 | ), |
| 426 | ); |
| 427 | }; |
| 428 | } |
| 429 | |
| 430 | fn make_grep_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_grep_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 431 | styles.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][`Extend<(K, V)>`]extend().([ |
| 432 | ( |
| 433 | "grep-match-line-style", |
| 434 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) = &opt.grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_match_line_style. { |
| 435 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().(s, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().()) |
| 436 | } else { |
| 437 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("zero-style".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 438 | }, |
| 439 | ), |
| 440 | ( |
| 441 | "grep-match-word-style", |
| 442 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) = &opt.grep_match_word_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_match_word_style. { |
| 443 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().(s, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().()) |
| 444 | } else { |
| 445 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("plus-emph-style".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 446 | }, |
| 447 | ), |
| 448 | ( |
| 449 | "grep-context-line-style", |
| 450 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) = &opt.grep_context_line_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_context_line_style. { |
| 451 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().(s, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().()) |
| 452 | } else { |
| 453 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("zero-style".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 454 | }, |
| 455 | ), |
| 456 | ( |
| 457 | "grep-file-style", |
| 458 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 459 | &opt.grep_file_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_file_style., |
| 460 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 461 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 462 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 463 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 464 | ), |
| 465 | ), |
| 466 | ( |
| 467 | "grep-line-number-style", |
| 468 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 469 | &opt.grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#grep_line_number_style., |
| 470 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 471 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 472 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 473 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 474 | ), |
| 475 | ), |
| 476 | ]) |
| 477 | } |
| 478 | |
| 479 | fn make_merge_conflict_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_merge_conflict_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 480 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 481 | "merge-conflict-ours-diff-header-style", |
| 482 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 483 | &opt.merge_conflict_ours_diff_header_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#merge_conflict_ours_diff_header_style., |
| 484 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 485 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&opt.merge_conflict_ours_diff_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#merge_conflict_ours_diff_header_decoration_style.), |
| 486 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 487 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 488 | ), |
| 489 | ); |
| 490 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 491 | "merge-conflict-theirs-diff-header-style", |
| 492 | style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 493 | &opt.merge_conflict_theirs_diff_header_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#merge_conflict_theirs_diff_header_style., |
| 494 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 495 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&opt.merge_conflict_theirs_diff_header_decoration_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#merge_conflict_theirs_diff_header_decoration_style.), |
| 496 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 497 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 498 | ), |
| 499 | ); |
| 500 | } |
| 501 | |
| 502 | fn make_misc_stylesrust-analyzer cargo git-delta 0.19.2 parse_styles/make_misc_styles().(opt: &clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#, styles: &mut HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) { |
| 503 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 504 | "inline-hint-style", |
| 505 | style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 506 | &opt.inline_hint_stylerust-analyzer cargo git-delta 0.19.2 cli/Opt#inline_hint_style., |
| 507 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 508 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 509 | opt.computedrust-analyzer cargo git-delta 0.19.2 cli/Opt#computed..true_colorrust-analyzer cargo git-delta 0.19.2 cli/ComputedValues#true_color., |
| 510 | opt.git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().(), |
| 511 | ), |
| 512 | ); |
| 513 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 514 | "git-minus-style", |
| 515 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#( |
| 516 | match opt |
| 517 | .git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().() |
| 518 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|cfg| cfg.getrust-analyzer cargo git-delta 0.19.2 git_config/impl#[GitConfig]get().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("color.diff.old")) |
| 519 | { |
| 520 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(&s), |
| 521 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => *rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_MINUS_STYLE][Deref]deref().stylerust-analyzer cargo git-delta 0.19.2 style/::GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE., |
| 522 | }, |
| 523 | ), |
| 524 | ); |
| 525 | styles.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().( |
| 526 | "git-plus-style", |
| 527 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#( |
| 528 | match opt |
| 529 | .git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]git_config().() |
| 530 | .and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|cfg| cfg.getrust-analyzer cargo git-delta 0.19.2 git_config/impl#[GitConfig]get().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>("color.diff.new")) |
| 531 | { |
| 532 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(&s), |
| 533 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => *rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_PLUS_STYLE][Deref]deref().stylerust-analyzer cargo git-delta 0.19.2 style/::GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE., |
| 534 | }, |
| 535 | ), |
| 536 | ); |
| 537 | } |
| 538 | |
| 539 | fn style_from_strrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str().( |
| 540 | style_string: &str, |
| 541 | default: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>, |
| 542 | decoration_style_string: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, |
| 543 | true_color: bool, |
| 544 | git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>, |
| 545 | ) -> StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference# { |
| 546 | if is_style_referencerust-analyzer cargo git-delta 0.19.2 parse_styles/is_style_reference().(style_string) { |
| 547 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#(style_string.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 548 | } else { |
| 549 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str().( |
| 550 | style_string, |
| 551 | default, |
| 552 | decoration_style_string, |
| 553 | true_color, |
| 554 | git_config, |
| 555 | )) |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | fn style_from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_styles/style_from_str_with_handling_of_special_decoration_attributes().( |
| 560 | style_string: &str, |
| 561 | default: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>, |
| 562 | decoration_style_string: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, |
| 563 | true_color: bool, |
| 564 | git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>, |
| 565 | ) -> StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference# { |
| 566 | if is_style_referencerust-analyzer cargo git-delta 0.19.2 parse_styles/is_style_reference().(style_string) { |
| 567 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#(style_string.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()) |
| 568 | } else { |
| 569 | StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#( |
| 570 | Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_str_with_handling_of_special_decoration_attributesrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_str_with_handling_of_special_decoration_attributes().( |
| 571 | style_string, |
| 572 | default, |
| 573 | decoration_style_string, |
| 574 | true_color, |
| 575 | git_config, |
| 576 | ), |
| 577 | ) |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | #[cfg(test)] |
| 582 | mod testsrust-analyzer cargo git-delta 0.19.2 parse_styles/tests/ { |
| 583 | use superrust-analyzer cargo git-delta 0.19.2 parse_styles/::*; |
| 584 | use craterust-analyzer cargo git-delta 0.19.2 crate/::testsrust-analyzer cargo git-delta 0.19.2 tests/::integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/; |
| 585 | |
| 586 | fn resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/tests/resolve_style_references().(edges: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#>) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stylerust-analyzer cargo git-delta 0.19.2 style/Style#> { |
| 587 | let opt = integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/::make_options_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_options_from_args().(&[]); |
| 588 | superrust-analyzer cargo git-delta 0.19.2 parse_styles/::resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/resolve_style_references().(edges, &opt) |
| 589 | } |
| 590 | |
| 591 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 592 | fn test_resolve_style_references_1rust-analyzer cargo git-delta 0.19.2 parse_styles/tests/test_resolve_style_references_1().() { |
| 593 | let style_1 = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().(); |
| 594 | let style_2 = stylerust-analyzer cargo git-delta 0.19.2 style/::Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 595 | is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().style_1.is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted., |
| 596 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().() |
| 597 | }; |
| 598 | |
| 599 | let edges: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#> = [ |
| 600 | ("a", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style_1)), |
| 601 | ("b", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("c".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 602 | ("c", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style_2)), |
| 603 | ] |
| 604 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 605 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().a, b.clonerust-analyzer cargo git-delta 0.19.2 parse_styles/impl#[StyleReference][Clone]clone().())) |
| 606 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 607 | |
| 608 | let expected = [("a", style_1), ("b", style_2), ("c", style_2)] |
| 609 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 610 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (a.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b)) |
| 611 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 612 | |
| 613 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/tests/resolve_style_references().(edges), expected); |
| 614 | } |
| 615 | |
| 616 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 617 | fn test_resolve_style_references_2rust-analyzer cargo git-delta 0.19.2 parse_styles/tests/test_resolve_style_references_2().() { |
| 618 | let style_1 = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().(); |
| 619 | let style_2 = stylerust-analyzer cargo git-delta 0.19.2 style/::Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 620 | is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.: !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().style_1.is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted., |
| 621 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().() |
| 622 | }; |
| 623 | |
| 624 | let edges: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#> = [ |
| 625 | ("a", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("b".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 626 | ("b", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("c".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 627 | ("c", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style_1)), |
| 628 | ("d", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("b".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 629 | ("e", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("a".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 630 | ("f", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Stylerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Style#(style_2)), |
| 631 | ("g", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("f".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 632 | ("h", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("g".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 633 | ("i", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("g".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 634 | ] |
| 635 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 636 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().a, b.clonerust-analyzer cargo git-delta 0.19.2 parse_styles/impl#[StyleReference][Clone]clone().())) |
| 637 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 638 | |
| 639 | let expected = [ |
| 640 | ("a", style_1), |
| 641 | ("b", style_1), |
| 642 | ("c", style_1), |
| 643 | ("d", style_1), |
| 644 | ("e", style_1), |
| 645 | ("f", style_2), |
| 646 | ("g", style_2), |
| 647 | ("h", style_2), |
| 648 | ("i", style_2), |
| 649 | ] |
| 650 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 651 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (a.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b)) |
| 652 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 653 | |
| 654 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/tests/resolve_style_references().(edges), expected); |
| 655 | } |
| 656 | |
| 657 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 658 | fn test_resolve_style_references_cyclerust-analyzer cargo git-delta 0.19.2 parse_styles/tests/test_resolve_style_references_cycle().() { |
| 659 | let edges: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<&str, StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#> = [ |
| 660 | ("a", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("b".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 661 | ("b", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("c".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 662 | ("c", StyleReferencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#::Referencerust-analyzer cargo git-delta 0.19.2 parse_styles/StyleReference#Reference#("a".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), |
| 663 | ] |
| 664 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 665 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().a, b.clonerust-analyzer cargo git-delta 0.19.2 parse_styles/impl#[StyleReference][Clone]clone().())) |
| 666 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 667 | |
| 668 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 669 | resolve_style_referencesrust-analyzer cargo git-delta 0.19.2 parse_styles/tests/resolve_style_references().(edges).keysrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]keys().().nextrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Keys<'a, K, V>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 670 | "__cycle__" |
| 671 | ); |
| 672 | } |
| 673 | } |