Debian Codegraph @

src/features/line_numbers.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().;
2
3 use lazy_staticrust-analyzer cargo lazy_static 1.4.0 crate/::lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!;
4 use regexrust-analyzer cargo regex 1.12.3 crate/::Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#;
5
6 use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/::ColorModerust-analyzer cargo git-delta 0.19.2 color/ColorMode#::*;
7 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/;
8 use craterust-analyzer cargo git-delta 0.19.2 crate/::deltarust-analyzer cargo git-delta 0.19.2 delta/::Staterust-analyzer cargo git-delta 0.19.2 delta/State#;
9 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::hyperlinksrust-analyzer cargo git-delta 0.19.2 features/hyperlinks/;
10 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::side_by_siderust-analyzer cargo git-delta 0.19.2 features/side_by_side/::ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/::{selfrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/, ODD_PAD_CHARrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/ODD_PAD_CHAR.};
11 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::side_by_siderust-analyzer cargo git-delta 0.19.2 features/side_by_side/::{Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#, PanelSiderust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#, Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#};
12 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::OptionValueFunctionrust-analyzer cargo git-delta 0.19.2 features/OptionValueFunction#;
13 use craterust-analyzer cargo git-delta 0.19.2 crate/::formatrust-analyzer cargo git-delta 0.19.2 format/::{selfrust-analyzer cargo git-delta 0.19.2 format/, Alignrust-analyzer cargo git-delta 0.19.2 format/Align#, Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#};
14 use craterust-analyzer cargo git-delta 0.19.2 crate/::minusplusrust-analyzer cargo git-delta 0.19.2 minusplus/::*;
15 use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/::Stylerust-analyzer cargo git-delta 0.19.2 style/Style#;
16 use craterust-analyzer cargo git-delta 0.19.2 crate/::utilsrust-analyzer cargo git-delta 0.19.2 utils/;
17
18 pub fn make_featurerust-analyzer cargo git-delta 0.19.2 features/line_numbers/make_feature().() -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, OptionValueFunctionrust-analyzer cargo git-delta 0.19.2 features/OptionValueFunction#)> {
19 builtin_featurerust-analyzer cargo git-delta 0.19.2 features/builtin_feature!!([
20 (
21 "line-numbers",
22 bool,
23 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
24 _opt => true
25 ),
26 (
27 "line-numbers-left-style",
28 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
29 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
30 _opt => "blue"
31 ),
32 (
33 "line-numbers-right-style",
34 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
35 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
36 _opt => "blue"
37 ),
38 (
39 "line-numbers-minus-style",
40 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
41 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
42 opt => match 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. {
43 Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light# => "red",
44 Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark# => "88",
45 }
46 ),
47 (
48 "line-numbers-zero-style",
49 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
50 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
51 opt => match 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. {
52 Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light# => "#dddddd",
53 Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark# => "#444444",
54 }
55 ),
56 (
57 "line-numbers-plus-style",
58 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
59 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
60 opt => match 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. {
61 Lightrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Light# => "green",
62 Darkrust-analyzer cargo git-delta 0.19.2 color/ColorMode#Dark# => "28",
63 }
64 )
65 ])
66 }
67
68 pub fn linenumbers_and_stylesrust-analyzer cargo git-delta 0.19.2 features/line_numbers/linenumbers_and_styles().<'a>(
69 line_numbers_data: &'a mut LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#,
70 state: &Staterust-analyzer cargo git-delta 0.19.2 delta/State#,
71 config: &'a configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#,
72 increment: bool,
73 ) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>>, MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>)> {
74 let nr_left = line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().;
75 let nr_right = line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().;
76 let (minus_style, zero_style, plus_style) = (
77 config.line_numbers_style_minusplusrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_minusplus.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Minusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().,
78 config.line_numbers_zero_stylerust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_zero_style.,
79 config.line_numbers_style_minusplusrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_minusplus.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Plusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().,
80 );
81 let ((minus_number, plus_number), (minus_style, plus_style)) = match state {
82 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkMinusrust-analyzer cargo git-delta 0.19.2 delta/State#HunkMinus#(_, _) => {
83 line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().increment as usize;
84 ((Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nr_left), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), (minus_style, plus_style))
85 }
86 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkMinusWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkMinusWrapped# => ((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#), (minus_style, plus_style)),
87 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkZerorust-analyzer cargo git-delta 0.19.2 delta/State#HunkZero#(_, _) => {
88 line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().increment as usize;
89 line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().increment as usize;
90 ((Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nr_left), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nr_right)), (zero_style, zero_style))
91 }
92 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkZeroWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkZeroWrapped# => ((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#), (zero_style, zero_style)),
93 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkPlusrust-analyzer cargo git-delta 0.19.2 delta/State#HunkPlus#(_, _) => {
94 line_numbers_data.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`IndexMut<MinusPlusIndex>`]index_mut(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().increment as usize;
95 ((Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nr_right)), (minus_style, plus_style))
96 }
97 Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkPlusWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkPlusWrapped# => ((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#), (minus_style, plus_style)),
98 _ => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
99 };
100 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((
101 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(minus_number, plus_number),
102 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(minus_style, plus_style),
103 ))
104 }
105
•106 /// Return a vec of `ansi_term::AnsiGenericString`s representing the left and right fields of the
107 /// two-column line number display.
108 pub fn format_and_paint_line_numbersrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_and_paint_line_numbers().<'a>(
109 line_numbers_data: &'a LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#,
110 side_by_side_panel: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PanelSiderust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#>,
111 styles: MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>,
112 line_numbers: MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>>,
113 config: &'a configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#,
•114 ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#<'a, str>> {
115 let mut formatted_numbers = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
116
117 let (emit_left, emit_right) = match (config.side_by_siderust-analyzer cargo git-delta 0.19.2 config/Config#side_by_side., side_by_side_panel) {
118 (false, _) => (true, true),
119 (true, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#)) => (true, false),
120 (true, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#)) => (false, true),
121 (true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(),
122 };
123
124 if emit_left {
125 formatted_numbers.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(format_and_paint_line_number_fieldrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_and_paint_line_number_field().(
126 line_numbers_data,
127 Minusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#,
128 &styles,
129 &line_numbers,
130 config,
131 ));
132 }
133
134 if emit_right {
135 formatted_numbers.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(format_and_paint_line_number_fieldrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_and_paint_line_number_field().(
136 line_numbers_data,
137 Plusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#,
138 &styles,
139 &line_numbers,
140 config,
141 ));
142 }
143 formatted_numbers
144 }
145
146 lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! {
147 static ref LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# =
148 formatrust-analyzer cargo git-delta 0.19.2 format/::make_placeholder_regexrust-analyzer cargo git-delta 0.19.2 format/make_placeholder_regex().(&["nm", "np"]);
149 }
150
151 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
152 pub struct LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#<'a> {
153 pub format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.: MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringData#<'a>>,
154 pub line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number.: MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<usize>,
155 pub hunk_max_line_number_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#hunk_max_line_number_width.: usize,
156 pub plus_filerust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#plus_file.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
157 }
158
159 pub type SideBySideLineWidthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/SideBySideLineWidth# = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<usize>;
160
161 // Although it's probably unusual, a single format string can contain multiple placeholders. E.g.
162 // line-numbers-right-format = "{nm} {np}|"
163 impl<'a> LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#<'a> {
164 pub fn from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(
165 format: &'a MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
166 use_full_width: ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/::UseFullPanelWidthrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/UseFullPanelWidth#,
167 ) -> LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#<'a> {
168 let insert_center_space_on_odd_width = use_full_width.pad_widthrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth]pad_width().();
169 Selfrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`] {
170 format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.: MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(
171 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().(
172 &format[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
173 &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX.,
174 false,
175 ),
176 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().(
177 &format[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
178 &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX.,
179 insert_center_space_on_odd_width,
180 ),
181 ),
182 ..Selfrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]::defaultrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`][Default]default().()
183 }
184 }
185
186 /// Initialize line number data for a hunk.
187 pub fn initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&mut self, line_numbers: &[(usize, usize)], plus_file: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
188 // Typically, line_numbers has length 2: an entry for the minus file, and one for the plus
189 // file. In the case of merge commits, it may be longer.
190 self.line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#line_number. =
191 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(line_numbers[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..0, line_numbers[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().line_numbers.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..0);
192 let hunk_max_line_number = line_numbers.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(n, d)| n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<Self>`]add().d).maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#max().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
193 self.hunk_max_line_number_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#hunk_max_line_number_width. =
194 1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().(hunk_max_line_number as f64).log10rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]log10().().floorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/impl#[f64]floor().() as usize;
195 self.plus_filerust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#plus_file. = plus_file;
196 }
197
198 pub fn empty_for_sbsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]empty_for_sbs().(use_full_width: ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/::UseFullPanelWidthrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/UseFullPanelWidth#) -> LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#<'a> {
199 let insert_center_space_on_odd_width = use_full_width.pad_widthrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth]pad_width().();
200 Selfrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`] {
201 format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.: if insert_center_space_on_odd_width {
202 let format_left = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()];
203 let format_right = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
204 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{ODD_PAD_CHAR}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
205 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 1,
206 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
207 }];
208 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(format_left, format_right)
209 } else {
210 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::defaultrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][Default]default().()
211 },
212 ..Selfrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]::defaultrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`][Default]default().()
213 }
214 }
215
216 pub fn formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(&self) -> SideBySideLineWidthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/SideBySideLineWidth# {
217 let format_data_width = |format_data: &formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringData#<'a>| {
218 // Provide each Placeholder with the max_line_number_width to calculate the
219 // actual width. Only use prefix and suffix of the last element, otherwise
220 // only the prefix (as the suffix also contains the following prefix).
221 format_data
222 .lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]last().()
223 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|last| {
224 let (prefix_width, suffix_width) = last.widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(self.hunk_max_line_number_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#hunk_max_line_number_width.);
225 format_data
226 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
227 .revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().()
228 .skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(1)
229 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|p| p.widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(self.hunk_max_line_number_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#hunk_max_line_number_width.).0)
230 .sumrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#sum().::<usize>()
231 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().prefix_width
232 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().suffix_width
233 })
234 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0)
235 };
236 MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(
237 format_data_width(&self.format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().),
238 format_data_width(&self.format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().),
239 )
240 }
241 }
242
243 #[allow(clippy::too_many_arguments)]
244 fn format_and_paint_line_number_fieldrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_and_paint_line_number_field().<'a>(
245 line_numbers_data: &'a LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#,
246 side: MinusPlusIndexrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#,
247 styles: &MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Stylerust-analyzer cargo git-delta 0.19.2 style/Style#>,
248 line_numbers: &MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>>,
249 config: &configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#,
•250 ) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#<'a, str>> {
251 let min_field_width = line_numbers_data.hunk_max_line_number_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#hunk_max_line_number_width.;
252
253 let format_data = &line_numbers_data.format_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#format_data.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().side]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().;
254 let plus_file = &line_numbers_data.plus_filerust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#plus_file.;
255 let style = &config.line_numbers_style_leftrightrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_leftright.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().side]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().;
256
257 let mut ansi_strings = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
258 let mut suffix = "";
259 for placeholder in format_data {
260 ansi_strings.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(style.paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().(placeholder.prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix..as_strrust-analyzer cargo smol_str 0.1.24 impl#[SmolStr]as_str().()));
261
262 let width = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(placeholder_width) = placeholder.widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width. {
263 maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(placeholder_width, min_field_width)
264 } else {
265 min_field_width
266 };
267
268 let alignment_spec = placeholder.alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Centerrust-analyzer cargo git-delta 0.19.2 format/Align#Center#);
269 match placeholder.placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder. {
270 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#) => {
271 ansi_strings.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(styles[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Minusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().(format_line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_line_number().(
272 line_numbers[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Minusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
273 alignment_spec,
274 width,
275 placeholder.precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.,
276 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
277 config,
278 )))
279 }
280 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#) => {
281 ansi_strings.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(styles[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Plusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().(format_line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_line_number().(
282 line_numbers[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().Plusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().,
283 alignment_spec,
284 width,
285 placeholder.precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.,
286 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(plus_file),
287 config,
288 )))
289 }
290 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {}
291 _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!("Invalid placeholder"),
292 }
293 suffix = placeholder.suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix..as_strrust-analyzer cargo smol_str 0.1.24 impl#[SmolStr]as_str().();
294 }
295 ansi_strings.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(style.paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().(suffix));
296 ansi_strings
297 }
298
299 /// Return line number formatted according to `alignment` and `width`.
300 fn format_line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/format_line_number().(
301 line_number: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>,
302 alignment: Alignrust-analyzer cargo git-delta 0.19.2 format/Align#,
303 width: usize,
304 precision: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>,
305 plus_file: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
306 config: &configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#,
307 ) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
308 let pad = |n| formatrust-analyzer cargo git-delta 0.19.2 format/::padrust-analyzer cargo git-delta 0.19.2 format/pad().(n, width, alignment, precision);
309 match (line_number, config.hyperlinksrust-analyzer cargo git-delta 0.19.2 config/Config#hyperlinks., plus_file) {
310 (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, _, _) => " ".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(width),
311 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(n), true, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(file)) => match utilsrust-analyzer cargo git-delta 0.19.2 utils/::pathrust-analyzer cargo git-delta 0.19.2 utils/path/::absolute_pathrust-analyzer cargo git-delta 0.19.2 utils/path/absolute_path().(file, config) {
312 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(absolute_path) => {
313 hyperlinksrust-analyzer cargo git-delta 0.19.2 features/hyperlinks/::format_osc8_file_hyperlinkrust-analyzer cargo git-delta 0.19.2 features/hyperlinks/format_osc8_file_hyperlink().(absolute_path, line_number, &pad(n), config)
314 .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
315 }
316 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => pad(n),
317 },
318 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(n), _, _) => pad(n),
319 }
320 }
321
322 #[cfg(test)]
323 pub mod testsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/ {
324 use regexrust-analyzer cargo regex 1.12.3 crate/::Capturesrust-analyzer cargo regex 1.12.3 regex/string/Captures#;
325
326 use craterust-analyzer cargo git-delta 0.19.2 crate/::ansirust-analyzer cargo git-delta 0.19.2 ansi/::strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().;
327 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::side_by_siderust-analyzer cargo git-delta 0.19.2 features/side_by_side/::ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/::ODD_PAD_CHARrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/ODD_PAD_CHAR.;
328 use craterust-analyzer cargo git-delta 0.19.2 crate/::formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringData#;
329 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/::{make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args()., run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta()., DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#};
330
331 use superrust-analyzer cargo git-delta 0.19.2 features/line_numbers/::*;
332
333 pub fn parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().(
334 format_string: &str,
335 ) -> FormatStringDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringData#<'_> {
336 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().(format_string, &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX., false)
337 }
338
339 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
340 fn test_line_number_format_regex_1rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_1().() {
341 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
342 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("{nm}"),
343 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
344 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
345 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#),
346 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
347 }]
348 )
349 }
350
351 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
352 fn test_line_number_format_regex_2rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_2().() {
353 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
354 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("{np:4}"),
355 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
356 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
357 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
358 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
359 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
360 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
361 }]
362 )
363 }
364
365 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
366 fn test_line_number_format_regex_3rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_3().() {
367 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
368 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("{np:>4}"),
369 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
370 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
371 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
372 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Rightrust-analyzer cargo git-delta 0.19.2 format/Align#Right#),
373 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
374 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
375 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
376 }]
377 )
378 }
379
380 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
381 fn test_line_number_format_regex_4rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_4().() {
382 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
383 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("{np:_>4}"),
384 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
385 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
386 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
387 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Rightrust-analyzer cargo git-delta 0.19.2 format/Align#Right#),
388 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
389 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
390 }]
391 )
392 }
393
394 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
395 fn test_line_number_format_regex_5rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_5().() {
396 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
397 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("__{np:_>4}@@"),
398 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
399 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "__".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
400 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
401 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Rightrust-analyzer cargo git-delta 0.19.2 format/Align#Right#),
402 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
403 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
404 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "@@".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
405 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 2,
406 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 2,
407 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
408 }]
409 )
410 }
411
412 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
413 fn test_line_number_format_regex_6rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_6().() {
414 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
415 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("__{nm:<3}@@---{np:_>4}**"),
416 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
417 formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
418 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "__".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
419 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#),
420 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Leftrust-analyzer cargo git-delta 0.19.2 format/Align#Left#),
421 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(3),
422 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
423 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "@@---{np:_>4}**".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
424 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 2,
425 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 15,
426 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
427 },
428 formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
429 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "@@---".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
430 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
431 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Rightrust-analyzer cargo git-delta 0.19.2 format/Align#Right#),
432 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
433 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
434 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "**".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
435 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 5,
436 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 2,
437 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
438 }
439 ]
440 )
441 }
442
443 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
444 fn test_line_number_format_regex_7rust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_regex_7().() {
445 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
446 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("__@@---**",),
447 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
448 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
449 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
450 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
451 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
452 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
453 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "__@@---**".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
454 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 0,
455 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 9,
456 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
457 },]
458 )
459 }
460
461 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
462 fn test_line_number_format_odd_width_onerust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_odd_width_one().() {
463 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
464 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().("|{nm:<4}|", &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX., true),
465 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
466 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{ODD_PAD_CHAR}|").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
467 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#),
468 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Leftrust-analyzer cargo git-delta 0.19.2 format/Align#Left#),
469 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
470 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
471 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "|".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
472 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 2,
473 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 1,
474 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
475 }]
476 );
477 }
478
479 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
480 fn test_line_number_format_odd_width_tworust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_odd_width_two().() {
481 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
482 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().(
483 "|{nm:<4}+{np:<4}|",
484 &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX.,
485 true
486 ),
487 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
488 formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
489 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{ODD_PAD_CHAR}|").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
490 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#),
491 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Leftrust-analyzer cargo git-delta 0.19.2 format/Align#Left#),
492 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
493 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
494 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "+{np:<4}|".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
495 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 2,
496 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 9,
497 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
498 },
499 formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
500 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: "+".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
501 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberPlusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberPlus#),
502 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Alignrust-analyzer cargo git-delta 0.19.2 format/Align#::Leftrust-analyzer cargo git-delta 0.19.2 format/Align#Left#),
503 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4),
504 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
505 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "|".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
506 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 1,
507 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 1,
508 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
509 }
510 ]
511 );
512 }
513 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
514 fn test_line_number_format_odd_width_nonerust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_odd_width_none().() {
515 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
516 formatrust-analyzer cargo git-delta 0.19.2 format/::parse_line_number_formatrust-analyzer cargo git-delta 0.19.2 format/parse_line_number_format().("|++|", &LINE_NUMBERS_PLACEHOLDER_REGEXrust-analyzer cargo git-delta 0.19.2 features/line_numbers/LINE_NUMBERS_PLACEHOLDER_REGEX., true),
517 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
518 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{ODD_PAD_CHAR}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
519 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
520 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
521 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
522 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
523 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: "|++|".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
524 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: 1,
525 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: 4,
526 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
527 }]
528 );
529 }
530
531 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
532 fn test_line_number_format_longrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_format_long().() {
533 let long = "line number format which is too large for SSO";
534 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(long.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<smol_strrust-analyzer cargo smol_str 0.1.24 crate/::SmolStrrust-analyzer cargo smol_str 0.1.24 SmolStr#>());
535 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
536 parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{long}{{nm}}{long}")),
537 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![formatrust-analyzer cargo git-delta 0.19.2 format/::FormatStringPlaceholderDatarust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderData# {
538 prefixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix.: long.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
539 prefix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#prefix_len.: long.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(),
540 placeholderrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#placeholder.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Placeholderrust-analyzer cargo git-delta 0.19.2 format/Placeholder#::NumberMinusrust-analyzer cargo git-delta 0.19.2 format/Placeholder#NumberMinus#),
541 alignment_specrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#alignment_spec.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
542 widthrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#width.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
543 precisionrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#precision.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
544 suffixrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix.: long.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
545 suffix_lenrust-analyzer cargo git-delta 0.19.2 format/FormatStringPlaceholderDataAnyPlaceholder#suffix_len.: long.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(),
546 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<T>`][Default]default().()
547 },]
548 )
549 }
550
551 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
552 fn test_line_number_placeholder_width_onerust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_placeholder_width_one().() {
553 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("");
554 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(0), (0, 0));
555
556 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("");
557 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (0, 0));
558
559 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│+│");
560 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (0, 3));
561
562 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("{np}");
563 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (4, 0));
564
565 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{np}│");
566 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (5, 1));
567
568 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{np:2}│");
569 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (5, 1));
570
571 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{np:6}│");
572 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(4), (7, 1));
573 }
574
575 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
576 fn test_line_number_placeholder_width_tworust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_number_placeholder_width_two().() {
577 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{nm}│{np}│");
578 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(1), (2, 6));
579 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(1), (2, 1));
580
581 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{nm:_>5}│{np:1}│");
582 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(1), (6, 8));
583 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(1), (2, 1));
584
585 let data = parse_line_number_format_with_default_regexrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/parse_line_number_format_with_default_regex().("│{nm}│{np:5}│");
586 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(7), (8, 8));
587 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..widthrust-analyzer cargo git-delta 0.19.2 format/impl#[`FormatStringPlaceholderDataAnyPlaceholder<Placeholder<'_>>`]width().(7), (8, 1));
588 }
589
590 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
591 fn test_line_numbers_datarust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_numbers_data().() {
592 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::side_by_siderust-analyzer cargo git-delta 0.19.2 features/side_by_side/::ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/;
593 let w = ansifillrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/::UseFullPanelWidthrust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/UseFullPanelWidth#(false);
594 let format = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().("".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
595 let mut data = LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#::from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(&format, w.clonerust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth][Clone]clone().());
596 data.initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&[(10, 11), (10000, 100001)], "a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
597 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data.formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(), MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(0, 0));
598
599 let format = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().("│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "│+│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
600 let mut data = LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#::from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(&format, w.clonerust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth][Clone]clone().());
601
602 data.initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&[(10, 11), (10000, 100001)], "a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
603 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data.formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(), MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(1, 3));
604
605 let format = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().("│{nm:^3}│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "│{np:^3}│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
606 let mut data = LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#::from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(&format, w.clonerust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth][Clone]clone().());
607
608 data.initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&[(10, 11), (10000, 100001)], "a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
609 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data.formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(), MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(8, 8));
610
611 let format = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().("│{nm:^3}│ │{np:<12}│ │{nm}│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
612 let mut data = LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#::from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(&format, w.clonerust-analyzer cargo git-delta 0.19.2 features/side_by_side/ansifill/impl#[UseFullPanelWidth][Clone]clone().());
613
614 data.initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&[(10, 11), (10000, 100001)], "a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
615 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data.formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(), MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(32, 0));
616
617 let format = MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().("│{np:^3}│ │{nm:<12}│ │{np}│".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
618 let mut data = LineNumbersDatarust-analyzer cargo git-delta 0.19.2 features/line_numbers/LineNumbersData#::from_format_stringsrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]from_format_strings().(&format, w);
619
620 data.initialize_hunkrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]initialize_hunk().(&[(10, 11), (10000, 100001)], "a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
621 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(data.formatted_widthrust-analyzer cargo git-delta 0.19.2 features/line_numbers/impl#[`LineNumbersData<'a>`]formatted_width().(), MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().(32, 0));
622 }
623
624 fn _get_capturerust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/_get_capture().<'a>(i: usize, j: usize, caps: &'a [Capturesrust-analyzer cargo regex 1.12.3 regex/string/Captures#]) -> &'a str {
625 caps[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..getrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Captures<'h>`]get().(j).map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().("", |m| m.as_strrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]as_str().())
626 }
627
628 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
629 fn test_two_minus_linesrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_two_minus_lines().() {
630 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(&[
631 "--line-numbers",
632 "--line-numbers-left-format",
633 "{nm:^4}⋮",
634 "--line-numbers-right-format",
635 "{np:^4}│",
636 "--line-numbers-left-style",
637 "0 1",
638 "--line-numbers-minus-style",
639 "0 2",
640 "--line-numbers-right-style",
641 "0 3",
642 "--line-numbers-plus-style",
643 "0 4",
644 ])
645 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(TWO_MINUS_LINES_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_MINUS_LINES_DIFF.)
646 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
647 r#"
648 #indent_mark
649 1 ⋮ │a = 1
650 2 ⋮ │b = 23456"#,
651 );
652 }
653
654 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
655 fn test_two_plus_linesrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_two_plus_lines().() {
656 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(&[
657 "--line-numbers",
658 "--line-numbers-left-format",
659 "{nm:^4}⋮",
660 "--line-numbers-right-format",
661 "{np:^4}│",
662 "--line-numbers-left-style",
663 "0 1",
664 "--line-numbers-minus-style",
665 "0 2",
666 "--line-numbers-right-style",
667 "0 3",
668 "--line-numbers-plus-style",
669 "0 4",
670 ])
671 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(TWO_PLUS_LINES_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_PLUS_LINES_DIFF.)
672 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
673 r#"
674 #indent_mark
675 ⋮ 1 │a = 1
676 ⋮ 2 │b = 234567"#,
677 );
678 }
679
680 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
681 fn test_one_minus_one_plus_linerust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_one_minus_one_plus_line().() {
682 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&[
683 "--line-numbers",
684 "--line-numbers-left-format",
685 "{nm:^4}⋮",
686 "--line-numbers-right-format",
687 "{np:^4}│",
688 "--line-numbers-left-style",
689 "0 1",
690 "--line-numbers-minus-style",
691 "0 2",
692 "--line-numbers-right-style",
693 "0 3",
694 "--line-numbers-plus-style",
695 "0 4",
696 ]);
697 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(ONE_MINUS_ONE_PLUS_LINE_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/ONE_MINUS_ONE_PLUS_LINE_DIFF., &config);
698 let output = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&output);
699 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::HEADER_LENrust-analyzer cargo git-delta 0.19.2 config/HEADER_LEN.);
700 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 1 ⋮ 1 │a = 1");
701 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 2 ⋮ │b = 2");
702 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮ 2 │bb = 2");
703 }
704
705 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
706 fn test_repeated_placeholderrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_repeated_placeholder().() {
707 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&[
708 "--line-numbers",
709 "--line-numbers-left-format",
710 "{nm:^4} {nm:^4}⋮",
711 "--line-numbers-right-format",
712 "{np:^4}│",
713 "--line-numbers-left-style",
714 "0 1",
715 "--line-numbers-minus-style",
716 "0 2",
717 "--line-numbers-right-style",
718 "0 3",
719 "--line-numbers-plus-style",
720 "0 4",
721 ]);
722 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(ONE_MINUS_ONE_PLUS_LINE_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/ONE_MINUS_ONE_PLUS_LINE_DIFF., &config);
723 let output = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&output);
724 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::HEADER_LENrust-analyzer cargo git-delta 0.19.2 config/HEADER_LEN.);
725 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 1 1 ⋮ 1 │a = 1");
726 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 2 2 ⋮ │b = 2");
727 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮ 2 │bb = 2");
728 }
729
730 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
731 fn test_five_digit_line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_five_digit_line_number().() {
732 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&["--line-numbers"]);
733 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(FIVE_DIGIT_LINE_NUMBER_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/FIVE_DIGIT_LINE_NUMBER_DIFF., &config);
734 let output = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&output);
735 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::HEADER_LENrust-analyzer cargo git-delta 0.19.2 config/HEADER_LEN.);
736 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "10000⋮10000│a = 1");
737 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "10001⋮ │b = 2");
738 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮10001│bb = 2");
739 }
740
741 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
742 fn test_unequal_digit_line_numberrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_unequal_digit_line_number().() {
743 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&["--line-numbers"]);
744 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(UNEQUAL_DIGIT_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/UNEQUAL_DIGIT_DIFF., &config);
745 let output = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&output);
746 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::HEADER_LENrust-analyzer cargo git-delta 0.19.2 config/HEADER_LEN.);
747 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "10000⋮ 9999│a = 1");
748 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "10001⋮ │b = 2");
749 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮10000│bb = 2");
750 }
751
752 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
753 fn test_color_onlyrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_color_only().() {
754 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&["--line-numbers", "--color-only"]);
755 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(TWO_MINUS_LINES_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_MINUS_LINES_DIFF., &config);
756 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(5);
757 let (line_1, line_2) = (lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
758 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(line_1), " 1 ⋮ │-a = 1");
759 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(line_2), " 2 ⋮ │-b = 23456");
760 }
761
762 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
763 fn test_hunk_header_style_is_omitrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_hunk_header_style_is_omit().() {
764 let config = make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&["--line-numbers", "--hunk-header-style", "omit"]);
765 let output = run_deltarust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/run_delta().(TWO_LINE_DIFFSrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_LINE_DIFFS., &config);
766 let output = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&output);
767 let mut lines = output.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(4);
768 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 1 ⋮ 1 │a = 1");
769 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 2 ⋮ │b = 2");
770 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮ 2 │bb = 2");
771 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "");
772 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 499⋮ 499│a = 3");
773 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " 500⋮ │b = 4");
774 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/skip/impl#[`Skip<I>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), " ⋮ 500│bb = 4");
775 }
776
777 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
778 fn test_line_numbers_continue_correctlyrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_numbers_continue_correctly().() {
779 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(&["--side-by-side", "--width", "44", "--line-fill-method=ansi"])
780 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFF.)
781 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
782 r#"
783 │ 1 │abc │ 1 │abc
784 │ 2 │a = left side │ 2 │a = right side
785 │ 3 │xyz │ 3 │xyz"#,
786 );
787 }
788
789 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
790 fn test_line_numbers_continue_correctly_after_wrappingrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/test_line_numbers_continue_correctly_after_wrapping().() {
791 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(&[
792 "--side-by-side",
793 "--width",
794 "32",
795 "--line-fill-method=ansi",
796 "--wrap-left-symbol",
797 "@",
798 "--wrap-right-symbol",
799 "@",
800 "--wrap-right-prefix-symbol",
801 ">",
802 ])
803 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFF.)
804 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
805 r#"
806 │ 1 │abc │ 1 │abc
807 │ 2 │a = left @│ 2 │a = right@
808 │ │side │ │ side
809 │ 3 │xyz │ 3 │xyz"#,
810 );
811
812 let cfg = &[
813 "--side-by-side",
814 "--width",
815 "42",
816 "--line-fill-method=ansi",
817 "--wrap-left-symbol",
818 "@",
819 "--wrap-right-symbol",
820 "@",
821 "--wrap-right-prefix-symbol",
822 ">",
823 ];
824
825 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(cfg)
826 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_WITH_LONGER_MINUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_WITH_LONGER_MINUS_1_CONTEXT.)
827 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
828 r#"
829 │ 1 │abc │ 1 │abc
830 │ 2 │a = one side │ 2 │a = one longer@
831 │ │ │ │ > side
832 │ 3 │xyz │ 3 │xyz"#,
833 );
834
835 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(cfg)
836 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_WITH_LONGER_PLUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_WITH_LONGER_PLUS_1_CONTEXT.)
837 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
838 r#"
839 │ 1 │abc │ 1 │abc
840 │ 2 │a = one longer@│ 2 │a = one side
841 │ │ > side│ │
842 │ 3 │xyz │ 3 │xyz"#,
843 );
844
845 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(cfg)
846 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_MISMATCH_LONGER_MINUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_MISMATCH_LONGER_MINUS_1_CONTEXT.)
847 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
848 r#"
849 │ 1 │abc │ 1 │abc
850 │ 2 │a = left side @│ │
851 │ │which is longer│ │
852 │ │ │ 2 │a = other one
853 │ 3 │xyz │ 3 │xyz"#,
854 );
855
856 DeltaTestrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/DeltaTest#::with_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_args().(cfg)
857 .with_inputrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[`DeltaTest<'a>`]with_input().(DIFF_MISMATCH_LONGER_PLUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_MISMATCH_LONGER_PLUS_1_CONTEXT.)
858 .expect_after_headerrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/impl#[DeltaTestOutput]expect_after_header().(
859 r#"
860 │ 1 │abc │ 1 │abc
861 │ 2 │a = other one │ │
862 │ │ │ 2 │a = right side@
863 │ │ │ │ which is long@
864 │ │ │ │er
865 │ 3 │xyz │ 3 │xyz"#,
866 );
867 }
868
869 pub const TWO_MINUS_LINES_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_MINUS_LINES_DIFF.: &str = "\
870 diff --git i/a.py w/a.py
871 index 223ca50..e69de29 100644
872 --- i/a.py
873 +++ w/a.py
874 @@ -1,2 +0,0 @@
875 -a = 1
876 -b = 23456
877 ";
878
879 pub const TWO_PLUS_LINES_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_PLUS_LINES_DIFF.: &str = "\
880 diff --git c/a.py i/a.py
881 new file mode 100644
882 index 0000000..223ca50
883 --- /dev/null
884 +++ i/a.py
885 @@ -0,0 +1,2 @@
886 +a = 1
887 +b = 234567
888 ";
889
890 pub const ONE_MINUS_ONE_PLUS_LINE_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/ONE_MINUS_ONE_PLUS_LINE_DIFF.: &str = "\
891 diff --git i/a.py w/a.py
892 index 223ca50..367a6f6 100644
893 --- i/a.py
894 +++ w/a.py
895 @@ -1,2 +1,2 @@
896 a = 1
897 -b = 2
898 +bb = 2
899 ";
900
901 const TWO_LINE_DIFFSrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_LINE_DIFFS.: &str = "\
902 diff --git i/a.py w/a.py
903 index 223ca50..367a6f6 100644
904 --- i/a.py
905 +++ w/a.py
906 @@ -1,2 +1,2 @@
907 a = 1
908 -b = 2
909 +bb = 2
910 @@ -499,2 +499,2 @@
911 a = 3
912 -b = 4
913 +bb = 4
914 ";
915
916 const FIVE_DIGIT_LINE_NUMBER_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/FIVE_DIGIT_LINE_NUMBER_DIFF.: &str = "\
917 diff --git i/a.py w/a.py
918 index 223ca50..367a6f6 100644
919 --- i/a.py
920 +++ w/a.py
921 @@ -10000,2 +10000,2 @@
922 a = 1
923 -b = 2
924 +bb = 2
925 ";
926
927 const UNEQUAL_DIGIT_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/UNEQUAL_DIGIT_DIFF.: &str = "\
928 diff --git i/a.py w/a.py
929 index 223ca50..367a6f6 100644
930 --- i/a.py
931 +++ w/a.py
932 @@ -10000,2 +9999,2 @@
933 a = 1
934 -b = 2
935 +bb = 2
936 ";
937
938 const DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_PLUS_MINUS_WITH_1_CONTEXT_DIFF.: &str = "\
939 --- a/a.py
940 +++ b/b.py
941 @@ -1,3 +1,3 @@
942 abc
943 -a = left side
944 +a = right side
945 xyz";
946
947 const DIFF_WITH_LONGER_MINUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_WITH_LONGER_MINUS_1_CONTEXT.: &str = "\
948 --- a/a.py
949 +++ b/b.py
950 @@ -1,3 +1,3 @@
951 abc
952 -a = one side
953 +a = one longer side
954 xyz";
955
956 const DIFF_WITH_LONGER_PLUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_WITH_LONGER_PLUS_1_CONTEXT.: &str = "\
957 --- a/a.py
958 +++ b/b.py
959 @@ -1,3 +1,3 @@
960 abc
961 -a = one longer side
962 +a = one side
963 xyz";
964
965 const DIFF_MISMATCH_LONGER_MINUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_MISMATCH_LONGER_MINUS_1_CONTEXT.: &str = "\
966 --- a/a.py
967 +++ b/b.py
968 @@ -1,3 +1,3 @@
969 abc
970 -a = left side which is longer
971 +a = other one
972 xyz";
973
974 const DIFF_MISMATCH_LONGER_PLUS_1_CONTEXTrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/DIFF_MISMATCH_LONGER_PLUS_1_CONTEXT.: &str = "\
975 --- a/a.py
976 +++ b/b.py
977 @@ -1,3 +1,3 @@
978 abc
979 -a = other one
980 +a = right side which is longer
981 xyz";
982
983 pub const TWO_MINUS_LINES_UNICODE_DIFFrust-analyzer cargo git-delta 0.19.2 features/line_numbers/tests/TWO_MINUS_LINES_UNICODE_DIFF.: &str = "\
984 diff --git a/a.py b/a.py
985 index 8b0d958..e69de29 100644
986 --- a/a.txt
987 +++ b/b.txt
988 @@ -1,1 +0,0 @@
989 -一二三
990 ";
991 }