| 1 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 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 |
use serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#; |
| 6 |
|
| 7 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::ansirust-analyzer cargo git-delta 0.19.2 ansi/; |
| 8 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::{ |
| 9 |
delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable()., GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#, HunkHeaderIncludeCodeFragmentrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#, HunkHeaderIncludeFilePathrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeFilePath#, |
| 10 |
HunkHeaderIncludeLineNumberrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#, |
| 11 |
}; |
| 12 |
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#, StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#}; |
| 13 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::{selfrust-analyzer cargo git-delta 0.19.2 handlers/, ripgrep_jsonrust-analyzer cargo git-delta 0.19.2 handlers/ripgrep_json/}; |
| 14 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/::{selfrust-analyzer cargo git-delta 0.19.2 paint/, BgShouldFillrust-analyzer cargo git-delta 0.19.2 paint/BgShouldFill#, StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#}; |
| 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/::{processrust-analyzer cargo git-delta 0.19.2 utils/process/, tabsrust-analyzer cargo git-delta 0.19.2 utils/tabs/}; |
| 17 |
|
| 18 |
use superrust-analyzer cargo git-delta 0.19.2 handlers/::hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/::HunkHeaderIncludeHunkLabelrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#; |
| 19 |
|
| 20 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 21 |
pub struct GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#<'b> { |
| 22 |
pub grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#, |
| 23 |
pub pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'b, str>, |
| 24 |
pub line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 25 |
pub line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#, |
| 26 |
pub coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'b, str>, |
| 27 |
pub submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(usize, usize)>>, |
| 28 |
} |
| 29 |
|
| 30 |
impl GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#<'_> { |
| 31 |
fn expand_tabsrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`GrepLine<'_>`]expand_tabs().(&mut self, tab_cfg: &tabsrust-analyzer cargo git-delta 0.19.2 utils/tabs/::TabCfgrust-analyzer cargo git-delta 0.19.2 utils/tabs/TabCfg#) { |
| 32 |
let old_len = self.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(); |
| 33 |
self.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code. = tabsrust-analyzer cargo git-delta 0.19.2 utils/tabs/::expandrust-analyzer cargo git-delta 0.19.2 utils/tabs/expand().(&self.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., tab_cfg).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 34 |
let shift = self.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]saturating_sub().(old_len); |
| 35 |
// HACK: it is not necessarily the case that all submatch coordinates |
| 36 |
// should be shifted in this way. It should be true in a common case of: |
| 37 |
// (a) the only tabs were at the beginning of the line, and (b) the user |
| 38 |
// was not searching for tabs. |
| 39 |
self.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches. = self.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|submatches| { |
| 40 |
submatches |
| 41 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 42 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(a, b)| (a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().shift, b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().shift)) |
| 43 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 44 |
}); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:)] |
| 49 |
#[serde(rename_all = "lowercase")] |
| 50 |
pub enum LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType# { |
| 51 |
ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader#, |
| 52 |
Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 53 |
FileHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#FileHeader#, |
| 54 |
Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 55 |
Ignorerust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Ignore#, |
| 56 |
} |
| 57 |
|
| 58 |
struct GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# { |
| 59 |
add_navigate_marker_to_matchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#add_navigate_marker_to_matches.: bool, |
| 60 |
render_context_header_as_hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#render_context_header_as_hunk_header.: bool, |
| 61 |
pad_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#pad_line_number.: bool, |
| 62 |
} |
| 63 |
|
| 64 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 65 |
static ref OUTPUT_CONFIGrust-analyzer cargo git-delta 0.19.2 handlers/grep/OUTPUT_CONFIG#: GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# = make_output_configrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_output_config().(); |
| 66 |
} |
| 67 |
|
| 68 |
impl LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType# { |
| 69 |
fn file_path_separatorrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType]file_path_separator().(&self) -> &str { |
| 70 |
// grep, rg, and git grep use ":" for matching lines |
| 71 |
// and "-" for non-matching lines (and `git grep -W` |
| 72 |
// uses "=" for a context header line). |
| 73 |
match self { |
| 74 |
LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match# => ":", |
| 75 |
LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context# => "-", |
| 76 |
LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader# => "=", |
| 77 |
LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Ignorerust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Ignore# | LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::FileHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#FileHeader# => "", |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
impl StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#<'_> { |
| 83 |
// If this is a line of grep output then render it accordingly. |
| 84 |
pub fn handle_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]handle_grep_line().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> { |
| 85 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..emitrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]emit().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 86 |
|
| 87 |
let (previous_path, previous_line_type, previous_line, try_parse) = match &self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state. { |
| 88 |
Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Greprust-analyzer cargo git-delta 0.19.2 delta/State#Grep#(_, line_type, path, line_number) => { |
| 89 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().()), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_type), line_number, true) |
| 90 |
} |
| 91 |
Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/State#Unknown# => (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#, &Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true), |
| 92 |
_ => (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#, &Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, false), |
| 93 |
}; |
| 94 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().try_parse { |
| 95 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false); |
| 96 |
} |
| 97 |
|
| 98 |
// Try parse_raw_grep_line on raw_line, and fall back to parse_grep_line |
| 99 |
let raw_line = self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(); // TODO: avoid clone |
| 100 |
let line; |
| 101 |
let grep_line = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(grep_line) = parse_raw_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_raw_grep_line().(&raw_line) { |
| 102 |
grep_line |
| 103 |
} else { |
| 104 |
line = self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(); // TODO: avoid clone |
| 105 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(grep_line) = parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(&line) { |
| 106 |
grep_line |
| 107 |
} else { |
| 108 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false); |
| 109 |
} |
| 110 |
}; |
| 111 |
|
| 112 |
if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Ignorerust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Ignore#) { |
| 113 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true); |
| 114 |
} |
| 115 |
let first_path = previous_path.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().(); |
| 116 |
let new_path = first_path || previous_path.as_derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_deref().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.); |
| 117 |
let line_number_jump = previous_line rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialOrd<&B>`]lt().&grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|n| n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Sub<usize>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Sub<usize>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Sub<usize>`]sub().1); |
| 118 |
// Emit a '--' section separator when output contains context lines (i.e. *grep option -A, -B, -C is in effect). |
| 119 |
let new_section = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().new_path |
| 120 |
&& (previous_line_type rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#) |
| 121 |
|| grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type. rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType][`PartialEq<Self>`]eq().LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#) |
| 122 |
&& line_number_jump; |
| 123 |
if new_path { |
| 124 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..set_syntaxrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]set_syntax().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().())); |
| 125 |
} |
| 126 |
if new_path || new_section { |
| 127 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..set_highlighterrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]set_highlighter().() |
| 128 |
} |
| 129 |
self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state. = Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Greprust-analyzer cargo git-delta 0.19.2 delta/State#Grep#( |
| 130 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config. |
| 131 |
.grep_output_typerust-analyzer cargo git-delta 0.19.2 config/Config#grep_output_type. |
| 132 |
.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().() |
| 133 |
.unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| grep_line.grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type..clonerust-analyzer cargo git-delta 0.19.2 config/impl#[GrepType][Clone]clone().()), |
| 134 |
grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., |
| 135 |
grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 136 |
grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number., |
| 137 |
); |
| 138 |
match &self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state. { |
| 139 |
Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Greprust-analyzer cargo git-delta 0.19.2 delta/State#Grep#(GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Ripgreprust-analyzer cargo git-delta 0.19.2 config/GrepType#Ripgrep#, _, _, _) => { |
| 140 |
self.emit_ripgrep_format_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]emit_ripgrep_format_grep_line().(grep_line, new_path, first_path, new_section) |
| 141 |
} |
| 142 |
Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Greprust-analyzer cargo git-delta 0.19.2 delta/State#Grep#(GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, _, _, _) => { |
| 143 |
self.emit_classic_format_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]emit_classic_format_grep_line().(grep_line) |
| 144 |
} |
| 145 |
_ => delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable().("Impossible state while handling grep line."), |
| 146 |
}?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 147 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true) |
| 148 |
} |
| 149 |
|
| 150 |
// Emulate ripgrep output: each section of hits from the same path has a header line, |
| 151 |
// and sections are separated by a blank line. Set language whenever path changes. |
| 152 |
fn emit_ripgrep_format_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]emit_ripgrep_format_grep_line().( |
| 153 |
&mut self, |
| 154 |
mut grep_line: GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#, |
| 155 |
new_path: bool, |
| 156 |
first_path: bool, |
| 157 |
new_section: bool, |
| 158 |
) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 159 |
if new_path { |
| 160 |
// Emit new path header line |
| 161 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().first_path { |
| 162 |
writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 163 |
} |
| 164 |
handlersrust-analyzer cargo git-delta 0.19.2 handlers/::hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/::write_line_of_code_with_optional_path_and_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/write_line_of_code_with_optional_path_and_line_number().( |
| 165 |
"", |
| 166 |
&[(0, 0)], |
| 167 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 168 |
&mut self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter., |
| 169 |
&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line., |
| 170 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 171 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..ripgrep_header_stylerust-analyzer cargo git-delta 0.19.2 config/Config#ripgrep_header_style..decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style., |
| 172 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_file_style., |
| 173 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_line_number_style., |
| 174 |
&HunkHeaderIncludeFilePathrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeFilePath#::Yesrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeFilePath#Yes#, |
| 175 |
&HunkHeaderIncludeLineNumberrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#::Norust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#No#, |
| 176 |
&HunkHeaderIncludeHunkLabelrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#::Yesrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#Yes#, |
| 177 |
&HunkHeaderIncludeCodeFragmentrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#::YesNoSpacerust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#YesNoSpace#, |
| 178 |
"", |
| 179 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config., |
| 180 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 181 |
} |
| 182 |
if new_section { |
| 183 |
writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer., "--")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 184 |
} |
| 185 |
// Emit the actual grep hit line |
| 186 |
let code_style_sections = match (&grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., &grep_line.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.) { |
| 187 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_)) => { |
| 188 |
// We expand tabs at this late stage because |
| 189 |
// the tabs are escaped in the JSON, so |
| 190 |
// expansion must come after JSON parsing. |
| 191 |
// (At the time of writing, we are in this |
| 192 |
// arm iff we are handling `ripgrep --json` |
| 193 |
// output.) |
| 194 |
grep_line.expand_tabsrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`GrepLine<'_>`]expand_tabs().(&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..tab_cfgrust-analyzer cargo git-delta 0.19.2 config/Config#tab_cfg.); |
| 195 |
make_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_style_sections().( |
| 196 |
&grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., |
| 197 |
&grep_line.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 198 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_word_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_word_style., |
| 199 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 200 |
) |
| 201 |
} |
| 202 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => { |
| 203 |
// HACK: We need tabs expanded, and we need |
| 204 |
// the &str passed to |
| 205 |
// `get_code_style_sections` to live long |
| 206 |
// enough. But at this point it is guaranteed |
| 207 |
// that this handler is going to handle this |
| 208 |
// line, so mutating it is acceptable. |
| 209 |
self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = tabsrust-analyzer cargo git-delta 0.19.2 utils/tabs/::expandrust-analyzer cargo git-delta 0.19.2 utils/tabs/expand().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line., &self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..tab_cfgrust-analyzer cargo git-delta 0.19.2 config/Config#tab_cfg.); |
| 210 |
get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().( |
| 211 |
&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line., |
| 212 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_word_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_word_style., |
| 213 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 214 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 215 |
grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number., |
| 216 |
) |
| 217 |
.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#( |
| 218 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 219 |
)) |
| 220 |
} |
| 221 |
_ => StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#(self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_context_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_context_line_style.), |
| 222 |
}; |
| 223 |
handlersrust-analyzer cargo git-delta 0.19.2 handlers/::hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/::write_line_of_code_with_optional_path_and_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/write_line_of_code_with_optional_path_and_line_number().( |
| 224 |
&grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., |
| 225 |
&[(grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0), 0)], |
| 226 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(code_style_sections), |
| 227 |
&mut self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter., |
| 228 |
&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line., |
| 229 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 230 |
craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/::DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#, |
| 231 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_file_style., |
| 232 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_line_number_style., |
| 233 |
&HunkHeaderIncludeFilePathrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeFilePath#::Norust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeFilePath#No#, |
| 234 |
if grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 235 |
&HunkHeaderIncludeLineNumberrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#::Yesrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#Yes# |
| 236 |
} else { |
| 237 |
&HunkHeaderIncludeLineNumberrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#::Norust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeLineNumber#No# |
| 238 |
}, |
| 239 |
&HunkHeaderIncludeHunkLabelrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#::Norust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#No#, |
| 240 |
&HunkHeaderIncludeCodeFragmentrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#::YesNoSpacerust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#YesNoSpace#, |
| 241 |
grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type..file_path_separatorrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType]file_path_separator().(), |
| 242 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config., |
| 243 |
) |
| 244 |
} |
| 245 |
|
| 246 |
fn emit_classic_format_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]emit_classic_format_grep_line().(&mut self, grep_line: GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 247 |
match ( |
| 248 |
&grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., |
| 249 |
OUTPUT_CONFIGrust-analyzer cargo git-delta 0.19.2 handlers/grep/OUTPUT_CONFIG..render_context_header_as_hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#render_context_header_as_hunk_header., |
| 250 |
) { |
| 251 |
// Emit context header line (`git grep -W`) |
| 252 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader#, true) => { |
| 253 |
handlersrust-analyzer cargo git-delta 0.19.2 handlers/::hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/::write_line_of_code_with_optional_path_and_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/write_line_of_code_with_optional_path_and_line_number().( |
| 254 |
&grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., |
| 255 |
&[(grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number..unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(0), 0)], |
| 256 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 257 |
&mut self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter., |
| 258 |
&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line., |
| 259 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 260 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..classic_grep_header_stylerust-analyzer cargo git-delta 0.19.2 config/Config#classic_grep_header_style..decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style., |
| 261 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..classic_grep_header_file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#classic_grep_header_file_style., |
| 262 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_line_number_style., |
| 263 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..hunk_header_style_include_file_pathrust-analyzer cargo git-delta 0.19.2 config/Config#hunk_header_style_include_file_path., |
| 264 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..hunk_header_style_include_line_numberrust-analyzer cargo git-delta 0.19.2 config/Config#hunk_header_style_include_line_number., |
| 265 |
&HunkHeaderIncludeHunkLabelrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#::Yesrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/HunkHeaderIncludeHunkLabel#Yes#, |
| 266 |
&HunkHeaderIncludeCodeFragmentrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#::Yesrust-analyzer cargo git-delta 0.19.2 config/HunkHeaderIncludeCodeFragment#Yes#, |
| 267 |
grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type..file_path_separatorrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType]file_path_separator().(), |
| 268 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config., |
| 269 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 270 |
} |
| 271 |
_ => { |
| 272 |
if self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..navigaterust-analyzer cargo git-delta 0.19.2 config/Config#navigate. { |
| 273 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 274 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer., |
| 275 |
"{}", |
| 276 |
match ( |
| 277 |
&grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., |
| 278 |
OUTPUT_CONFIGrust-analyzer cargo git-delta 0.19.2 handlers/grep/OUTPUT_CONFIG..add_navigate_marker_to_matchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#add_navigate_marker_to_matches. |
| 279 |
) { |
| 280 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, true) => "• ", |
| 281 |
(_, true) => " ", |
| 282 |
_ => "", |
| 283 |
} |
| 284 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 285 |
} |
| 286 |
self._emit_classic_format_file_and_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]_emit_classic_format_file_and_line_number().(&grep_line)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 287 |
self._emit_classic_format_coderust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]_emit_classic_format_code().(grep_line)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 288 |
} |
| 289 |
} |
| 290 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 291 |
} |
| 292 |
|
| 293 |
fn _emit_classic_format_file_and_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]_emit_classic_format_file_and_line_number().( |
| 294 |
&mut self, |
| 295 |
grep_line: &GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#, |
| 296 |
) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 297 |
let separator = if self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_separator_symbolrust-analyzer cargo git-delta 0.19.2 config/Config#grep_separator_symbol. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."keep" { |
| 298 |
grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type..file_path_separatorrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[LineType]file_path_separator().() |
| 299 |
} else { |
| 300 |
// But ":" results in a "file/path:number:" |
| 301 |
// construct that terminal emulators are more likely |
| 302 |
// to recognize and render as a clickable link. If |
| 303 |
// navigate is enabled then there is already a good |
| 304 |
// visual indicator of match lines (in addition to |
| 305 |
// the grep-match-style highlighting) and so we use |
| 306 |
// ":" for matches and non-matches alike. |
| 307 |
&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_separator_symbolrust-analyzer cargo git-delta 0.19.2 config/Config#grep_separator_symbol. |
| 308 |
}; |
| 309 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 310 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer., |
| 311 |
"{}", |
| 312 |
paintrust-analyzer cargo git-delta 0.19.2 paint/::paint_file_path_with_line_numberrust-analyzer cargo git-delta 0.19.2 paint/paint_file_path_with_line_number().( |
| 313 |
grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number., |
| 314 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 315 |
OUTPUT_CONFIGrust-analyzer cargo git-delta 0.19.2 handlers/grep/OUTPUT_CONFIG..pad_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#pad_line_number., |
| 316 |
separator, |
| 317 |
true, |
| 318 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_file_style.), |
| 319 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_line_number_style.), |
| 320 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config. |
| 321 |
) |
| 322 |
)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 323 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 324 |
} |
| 325 |
|
| 326 |
fn _emit_classic_format_coderust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]_emit_classic_format_code().(&mut self, mut grep_line: GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 327 |
let code_style_sections = match (&grep_line.line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type., &grep_line.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.) { |
| 328 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_)) => { |
| 329 |
// We expand tabs at this late stage because |
| 330 |
// the tabs are escaped in the JSON, so |
| 331 |
// expansion must come after JSON parsing. |
| 332 |
// (At the time of writing, we are in this |
| 333 |
// arm iff we are handling `ripgrep --json` |
| 334 |
// output.) |
| 335 |
grep_line.expand_tabsrust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`GrepLine<'_>`]expand_tabs().(&self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..tab_cfgrust-analyzer cargo git-delta 0.19.2 config/Config#tab_cfg.); |
| 336 |
make_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_style_sections().( |
| 337 |
&grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., |
| 338 |
&grep_line.submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches..unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 339 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_word_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_word_style., |
| 340 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 341 |
) |
| 342 |
} |
| 343 |
(LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => { |
| 344 |
// HACK: We need tabs expanded, and we need |
| 345 |
// the &str passed to |
| 346 |
// `get_code_style_sections` to live long |
| 347 |
// enough. But at the point it is guaranteed |
| 348 |
// that this handler is going to handle this |
| 349 |
// line, so mutating it is acceptable. |
| 350 |
self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = tabsrust-analyzer cargo git-delta 0.19.2 utils/tabs/::expandrust-analyzer cargo git-delta 0.19.2 utils/tabs/expand().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line., &self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..tab_cfgrust-analyzer cargo git-delta 0.19.2 config/Config#tab_cfg.); |
| 351 |
get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().( |
| 352 |
&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line., |
| 353 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_word_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_word_style., |
| 354 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 355 |
&grep_line.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 356 |
grep_line.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number., |
| 357 |
) |
| 358 |
.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#( |
| 359 |
self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_match_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_match_line_style., |
| 360 |
)) |
| 361 |
} |
| 362 |
_ => StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#(self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..grep_context_line_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_context_line_style.), |
| 363 |
}; |
| 364 |
self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..syntax_highlight_and_paint_linerust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]syntax_highlight_and_paint_line().( |
| 365 |
&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}\n", grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.), |
| 366 |
code_style_sections, |
| 367 |
self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state..clonerust-analyzer cargo git-delta 0.19.2 delta/impl#[State][Clone]clone().(), |
| 368 |
BgShouldFillrust-analyzer cargo git-delta 0.19.2 paint/BgShouldFill#::defaultrust-analyzer cargo git-delta 0.19.2 paint/impl#[BgShouldFill][Default]default().(), |
| 369 |
); |
| 370 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 371 |
} |
| 372 |
} |
| 373 |
|
| 374 |
fn make_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_style_sections().<'a>( |
| 375 |
line: &'a str, |
| 376 |
submatches: &[(usize, usize)], |
| 377 |
match_style: Stylerust-analyzer cargo git-delta 0.19.2 style/Style#, |
| 378 |
non_match_style: Stylerust-analyzer cargo git-delta 0.19.2 style/Style#, |
| 379 |
) -> StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#<'a> { |
| 380 |
let mut sections = 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().(); |
| 381 |
let mut curr = 0; |
| 382 |
for (start_, end_) in submatches { |
| 383 |
let (start, end) = (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().start_, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().end_); |
| 384 |
if start rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().curr { |
| 385 |
sections.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((non_match_style, &line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().curr..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#start]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)) |
| 386 |
}; |
| 387 |
sections.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((match_style, &line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)); |
| 388 |
curr = end; |
| 389 |
} |
| 390 |
if curr rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() { |
| 391 |
sections.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((non_match_style, &line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().curr..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)) |
| 392 |
} |
| 393 |
StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::StyleSectionsrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#StyleSections#(sections) |
| 394 |
} |
| 395 |
|
| 396 |
// Return style sections describing colors received from git. |
| 397 |
fn get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().<'b>( |
| 398 |
raw_line: &'b str, |
| 399 |
match_style: Stylerust-analyzer cargo git-delta 0.19.2 style/Style#, |
| 400 |
non_match_style: Stylerust-analyzer cargo git-delta 0.19.2 style/Style#, |
| 401 |
path: &str, |
| 402 |
line_number: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, |
| 403 |
) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#<'b>> { |
| 404 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(prefix_end) = ansirust-analyzer cargo git-delta 0.19.2 ansi/::ansi_preserving_indexrust-analyzer cargo git-delta 0.19.2 ansi/ansi_preserving_index().( |
| 405 |
raw_line, |
| 406 |
match line_number { |
| 407 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(n) => formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{path}:{n}:").lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]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, |
| 408 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => path.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().(), |
| 409 |
}, |
| 410 |
) { |
| 411 |
let match_style_sections = ansirust-analyzer cargo git-delta 0.19.2 ansi/::parse_style_sectionsrust-analyzer cargo git-delta 0.19.2 ansi/parse_style_sections().(&raw_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().(prefix_end 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().1)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) |
| 412 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 413 |
.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(ansi_term_style, s)| { |
| 414 |
if ansi_term_style.is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold. |
| •415 |
&& ansi_term_style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#) |
| 416 |
{ |
| 417 |
(match_style, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().s) |
| 418 |
} else { |
| 419 |
(non_match_style, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().s) |
| 420 |
} |
| 421 |
}) |
| 422 |
.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 423 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::StyleSectionsrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#StyleSections#(match_style_sections)) |
| 424 |
} else { |
| 425 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
fn make_output_configrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_output_config().() -> GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# { |
| 430 |
match &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().processrust-analyzer cargo git-delta 0.19.2 utils/process/::calling_processrust-analyzer cargo git-delta 0.19.2 utils/process/calling_process().() { |
| 431 |
processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::GitGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#GitGrep#(command_line) |
| 432 |
if command_line.short_optionsrust-analyzer cargo git-delta 0.19.2 utils/process/CommandLine#short_options..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().("-W") |
| 433 |
|| command_line.long_optionsrust-analyzer cargo git-delta 0.19.2 utils/process/CommandLine#long_options..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().("--function-context") => |
| 434 |
{ |
| 435 |
// --function-context is in effect: i.e. the entire function is |
| 436 |
// being displayed. In that case we don't render the first line as a |
| 437 |
// header, since the second line is the true next line, and it will |
| 438 |
// be more readable to have these displayed normally. We do add the |
| 439 |
// navigate marker, since match lines will be surrounded by (many) |
| 440 |
// non-match lines. And, since we are printing (many) successive lines |
| 441 |
// of code, we pad line numbers <100 in order to maintain code |
| 442 |
// alignment up to line 9999. |
| 443 |
GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# { |
| 444 |
render_context_header_as_hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#render_context_header_as_hunk_header.: false, |
| 445 |
add_navigate_marker_to_matchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#add_navigate_marker_to_matches.: true, |
| 446 |
pad_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#pad_line_number.: true, |
| 447 |
} |
| 448 |
} |
| 449 |
processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::GitGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#GitGrep#(command_line) |
| 450 |
if command_line.short_optionsrust-analyzer cargo git-delta 0.19.2 utils/process/CommandLine#short_options..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().("-p") |
| 451 |
|| command_line.long_optionsrust-analyzer cargo git-delta 0.19.2 utils/process/CommandLine#long_options..containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().("--show-function") => |
| 452 |
{ |
| 453 |
// --show-function is in effect, i.e. the function header is being |
| 454 |
// displayed, along with matches within the function. Therefore we |
| 455 |
// render the first line as a header, but we do not add the navigate |
| 456 |
// marker, since all non-header lines are matches. |
| 457 |
GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# { |
| 458 |
render_context_header_as_hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#render_context_header_as_hunk_header.: true, |
| 459 |
add_navigate_marker_to_matchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#add_navigate_marker_to_matches.: false, |
| 460 |
pad_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#pad_line_number.: true, |
| 461 |
} |
| 462 |
} |
| 463 |
_ => GrepOutputConfigrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig# { |
| 464 |
render_context_header_as_hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#render_context_header_as_hunk_header.: true, |
| 465 |
add_navigate_marker_to_matchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#add_navigate_marker_to_matches.: false, |
| 466 |
pad_line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepOutputConfig#pad_line_number.: true, |
| 467 |
}, |
| 468 |
} |
| 469 |
} |
| 470 |
|
| 471 |
enum GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex# { |
| 472 |
WithColorrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithColor#, |
| 473 |
WithFileExtensionAndLineNumberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionAndLineNumber#, |
| 474 |
WithFileExtensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtension#, |
| 475 |
WithFileExtensionNoSpacesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionNoSpaces#, |
| 476 |
WithoutSeparatorCharactersrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithoutSeparatorCharacters#, |
| 477 |
} |
| 478 |
|
| 479 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 480 |
static ref GREP_LINE_REGEX_ASSUMING_COLORrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_COLOR#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = |
| 481 |
make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithColorrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithColor#); |
| 482 |
} |
| 483 |
|
| 484 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 485 |
static ref GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBERrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBER#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = |
| 486 |
make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionAndLineNumberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionAndLineNumber#); |
| 487 |
} |
| 488 |
|
| 489 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 490 |
static ref GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_NO_SPACESrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_NO_SPACES#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = |
| 491 |
make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionNoSpacesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionNoSpaces#); |
| 492 |
} |
| 493 |
|
| 494 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 495 |
static ref GREP_LINE_REGEX_ASSUMING_FILE_EXTENSIONrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = |
| 496 |
make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtension#); |
| 497 |
} |
| 498 |
|
| 499 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 500 |
static ref GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARSrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARS#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = |
| 501 |
make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithoutSeparatorCharactersrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithoutSeparatorCharacters#); |
| 502 |
} |
| 503 |
|
| 504 |
// See tests for example grep lines |
| 505 |
fn make_grep_line_regexrust-analyzer cargo git-delta 0.19.2 handlers/grep/make_grep_line_regex().(regex_variant: GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#) -> Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# { |
| 506 |
// Grep tools such as `git grep` and `rg` emit lines like the following, |
| 507 |
// where "xxx" represents arbitrary code. Note that there are 3 possible |
| 508 |
// "separator characters": ':', '-', '='. |
| 509 |
|
| 510 |
// The format is ambiguous, but we attempt to parse it. |
| 511 |
|
| 512 |
// src/co-7-fig.rs:xxx |
| 513 |
// src/co-7-fig.rs:7:xxx |
| 514 |
// src/co-7-fig.rs-xxx |
| 515 |
// src/co-7-fig.rs-7-xxx |
| 516 |
// src/co-7-fig.rs=xxx |
| 517 |
// src/co-7-fig.rs=7=xxx |
| 518 |
|
| 519 |
// Makefile:xxx |
| 520 |
// Makefile:7:xxx |
| 521 |
// Makefile-xxx |
| 522 |
// Makefile-7-xxx |
| 523 |
|
| 524 |
// Make-7-file:xxx |
| 525 |
// Make-7-file:7:xxx |
| 526 |
// Make-7-file-xxx |
| 527 |
// Make-7-file-7-xxx |
| 528 |
|
| 529 |
let file_path = match regex_variant { |
| 530 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithColorrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithColor# => { |
| 531 |
r" |
| 532 |
\x1b\[35m # starts with ANSI color sequence |
| 533 |
( # 1. file name |
| 534 |
[^\x1b]* # anything |
| 535 |
) |
| 536 |
\x1b\[m # ends with ANSI color reset |
| 537 |
" |
| 538 |
} |
| 539 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionAndLineNumberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionAndLineNumber# | GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtension# => { |
| 540 |
r" |
| 541 |
( # 1. file name (colons not allowed) |
| 542 |
[^:|\ ] # try to be strict about what a file path can start with |
| 543 |
[^:]* # anything |
| 544 |
[^\ ]\.[^.\ :=-]{1,10} # extension |
| 545 |
) |
| 546 |
" |
| 547 |
} |
| 548 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionNoSpacesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionNoSpaces# => { |
| 549 |
r" |
| 550 |
( # 1. file name (colons not allowed) |
| 551 |
[^:|\ ]+ # try to be strict about what a file path can start with |
| 552 |
[^\ ]\.[^.\ :=-]{1,6} # extension |
| 553 |
) |
| 554 |
" |
| 555 |
} |
| 556 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithoutSeparatorCharactersrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithoutSeparatorCharacters# => { |
| 557 |
r" |
| 558 |
( # 1. file name (colons not allowed) |
| 559 |
[^:|\ =-] # try to be strict about what a file path can start with |
| 560 |
[^:=-]* # anything except separators |
| 561 |
[^:\ ] # a file name cannot end with whitespace |
| 562 |
) |
| 563 |
" |
| 564 |
} |
| 565 |
}; |
| 566 |
|
| 567 |
let separator = match regex_variant { |
| 568 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithColorrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithColor# => { |
| 569 |
r#" |
| 570 |
\x1b\[36m # starts with ANSI color sequence for separator |
| 571 |
(?: |
| 572 |
( |
| 573 |
: # 2. match marker |
| 574 |
\x1b\[m # ANSI color reset |
| 575 |
(?: # optional: line number followed by second match marker |
| 576 |
\x1b\[32m # ANSI color sequence for line number |
| 577 |
([0-9]+) # 3. line number |
| 578 |
\x1b\[m # ANSI color reset |
| 579 |
\x1b\[36m # ANSI color sequence for separator |
| 580 |
: # second match marker |
| 581 |
\x1b\[m # ANSI color reset |
| 582 |
)? |
| 583 |
) |
| 584 |
| |
| 585 |
( |
| 586 |
- # 4. nomatch marker |
| 587 |
\x1b\[m # ANSI color reset |
| 588 |
(?: # optional: line number followed by second nomatch marker |
| 589 |
\x1b\[32m # ANSI color sequence for line number |
| 590 |
([0-9]+) # 5. line number |
| 591 |
\x1b\[m # ANSI color reset |
| 592 |
\x1b\[36m # ANSI color sequence for separator |
| 593 |
- # second nomatch marker |
| 594 |
\x1b\[m # ANSI color reset |
| 595 |
)? |
| 596 |
) |
| 597 |
| |
| 598 |
( |
| 599 |
= # 6. context header marker |
| 600 |
\x1b\[m # ANSI color reset |
| 601 |
(?: # optional: line number followed by second context header marker |
| 602 |
\x1b\[32m # ANSI color sequence for line number |
| 603 |
([0-9]+) # 7. line number |
| 604 |
\x1b\[m # ANSI color reset |
| 605 |
\x1b\[36m # ANSI color sequence for separator |
| 606 |
= # second context header marker |
| 607 |
\x1b\[m # ANSI color reset |
| 608 |
)? |
| 609 |
) |
| 610 |
) |
| 611 |
"# |
| 612 |
} |
| 613 |
GrepLineRegexrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#::WithFileExtensionAndLineNumberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLineRegex#WithFileExtensionAndLineNumber# => { |
| 614 |
r#" |
| 615 |
(?: |
| 616 |
( |
| 617 |
: # 2. match marker |
| 618 |
([0-9]+): # 3. line number followed by second match marker |
| 619 |
) |
| 620 |
| |
| 621 |
( |
| 622 |
- # 4. nomatch marker |
| 623 |
([0-9]+)- # 5. line number followed by second nomatch marker |
| 624 |
) |
| 625 |
| |
| 626 |
( |
| 627 |
= # 6. context header marker |
| 628 |
([0-9]+)= # 7. line number followed by second header marker |
| 629 |
) |
| 630 |
) |
| 631 |
"# |
| 632 |
} |
| 633 |
_ => { |
| 634 |
r#" |
| 635 |
(?: |
| 636 |
( |
| 637 |
: # 2. match marker |
| 638 |
(?:([0-9]+):)? # 3. optional: line number followed by second match marker |
| 639 |
) |
| 640 |
| |
| 641 |
( |
| 642 |
- # 4. nomatch marker |
| 643 |
(?:([0-9]+)-)? # 5. optional: line number followed by second nomatch marker |
| 644 |
) |
| 645 |
| |
| 646 |
( |
| 647 |
= # 6. context header marker |
| 648 |
(?:([0-9]+)=)? # 7. optional: line number followed by second header marker |
| 649 |
) |
| 650 |
) |
| 651 |
"# |
| 652 |
} |
| 653 |
}; |
| 654 |
|
| 655 |
Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#::newrust-analyzer cargo regex 1.12.3 regex/string/impl#[Regex]new().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 656 |
"(?x) |
| 657 |
^ |
| 658 |
{file_path} |
| 659 |
{separator} |
| 660 |
(.*) # 8. code (i.e. line contents) |
| 661 |
$ |
| 662 |
", |
| 663 |
)) |
| 664 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 665 |
} |
| 666 |
|
| 667 |
pub fn parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(line: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#<'_>> { |
| 668 |
if line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('{') { |
| 669 |
ripgrep_jsonrust-analyzer cargo git-delta 0.19.2 handlers/ripgrep_json/::parse_linerust-analyzer cargo git-delta 0.19.2 handlers/ripgrep_json/parse_line().(line) |
| 670 |
} else { |
| 671 |
match &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().processrust-analyzer cargo git-delta 0.19.2 utils/process/::calling_processrust-analyzer cargo git-delta 0.19.2 utils/process/calling_process().() { |
| 672 |
processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::GitGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#GitGrep#(_) | processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::OtherGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#OtherGrep# => [ |
| 673 |
&*rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBER][Deref]deref().GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBERrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBER., |
| 674 |
&*rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_NO_SPACES][Deref]deref().GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_NO_SPACESrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_NO_SPACES., |
| 675 |
&*rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION][Deref]deref().GREP_LINE_REGEX_ASSUMING_FILE_EXTENSIONrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION., |
| 676 |
&*rust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARS][Deref]deref().GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARSrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARS., |
| 677 |
] |
| 678 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 679 |
.find_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find_map().(|regex| _parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/_parse_grep_line().(regex, line)), |
| 680 |
_ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 681 |
} |
| 682 |
} |
| 683 |
} |
| 684 |
|
| 685 |
pub fn parse_raw_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_raw_grep_line().(raw_line: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#<'_>> { |
| 686 |
// Early exit if we don't have an escape sequence |
| 687 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().raw_line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('\x1b') { |
| 688 |
return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 689 |
} |
| 690 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 691 |
&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().processrust-analyzer cargo git-delta 0.19.2 utils/process/::calling_processrust-analyzer cargo git-delta 0.19.2 utils/process/calling_process().(), |
| 692 |
processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::GitGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#GitGrep#(_) | processrust-analyzer cargo git-delta 0.19.2 utils/process/::CallingProcessrust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#::OtherGreprust-analyzer cargo git-delta 0.19.2 utils/process/CallingProcess#OtherGrep# |
| 693 |
) { |
| 694 |
return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 695 |
} |
| 696 |
_parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/_parse_grep_line().(&GREP_LINE_REGEX_ASSUMING_COLORrust-analyzer cargo git-delta 0.19.2 handlers/grep/GREP_LINE_REGEX_ASSUMING_COLOR., raw_line).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|mut grep_line| { |
| 697 |
grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code. = ansirust-analyzer cargo git-delta 0.19.2 ansi/::strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&grep_line.coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 698 |
grep_line |
| 699 |
}) |
| 700 |
} |
| 701 |
|
| 702 |
pub fn _parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/_parse_grep_line().<'b>(regex: &Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#, line: &'b str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#<'b>> { |
| 703 |
let caps = regex.capturesrust-analyzer cargo regex 1.12.3 regex/string/impl#[Regex]captures().(line)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 704 |
let file = caps.getrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Captures<'h>`]get().(1).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().as_strrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]as_str().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 705 |
let (line_type, line_number) = &[ |
| 706 |
(2, LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#), |
| 707 |
(4, LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#), |
| 708 |
(6, LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader#), |
| 709 |
] |
| 710 |
.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 711 |
.find_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find_map().(|(i, line_type)| { |
| 712 |
if caps.getrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Captures<'h>`]get().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().i).is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() { |
| 713 |
let line_number: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> = caps.getrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Captures<'h>`]get().(i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().1).and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|m| m.as_strrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]as_str().().parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()); |
| 714 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().line_type, line_number)) |
| 715 |
} else { |
| 716 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 717 |
} |
| 718 |
}) |
| 719 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); // The regex matches so one of the three alternatives must have matched |
| 720 |
let code = caps.getrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Captures<'h>`]get().(8).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().as_strrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]as_str().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 721 |
|
| 722 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 723 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 724 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: file, |
| 725 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().line_number, |
| 726 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().line_type, |
| 727 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code., |
| 728 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 729 |
}) |
| 730 |
} |
| 731 |
|
| 732 |
#[cfg(test)] |
| 733 |
mod testsrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/ { |
| 734 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::greprust-analyzer cargo git-delta 0.19.2 handlers/grep/::{ |
| 735 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line()., parse_raw_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_raw_grep_line()., GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#, GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#, LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#, |
| 736 |
}; |
| 737 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::utilsrust-analyzer cargo git-delta 0.19.2 utils/::processrust-analyzer cargo git-delta 0.19.2 utils/process/::testsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/::FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#; |
| 738 |
|
| 739 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 740 |
fn test_parse_grep_matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_match().() { |
| 741 |
let fake_parent_grep_command = "git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 742 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 743 |
|
| 744 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 745 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/co-7-fig.rs:xxx"), |
| 746 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 747 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 748 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/co-7-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 749 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 750 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 751 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 752 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 753 |
}) |
| 754 |
); |
| 755 |
|
| 756 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 757 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs:use crate::minusplus::MinusPlus;"), |
| 758 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 759 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 760 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 761 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 762 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 763 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "use crate::minusplus::MinusPlus;".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 764 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 765 |
}) |
| 766 |
); |
| 767 |
|
| 768 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 769 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 770 |
"src/config.rs: pub line_numbers_style_minusplus: MinusPlus<Style>," |
| 771 |
), |
| 772 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 773 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 774 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 775 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 776 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 777 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub line_numbers_style_minusplus: MinusPlus<Style>,".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 778 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 779 |
}) |
| 780 |
); |
| 781 |
|
| 782 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 783 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/con-fig.rs:use crate::minusplus::MinusPlus;"), |
| 784 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 785 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 786 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/con-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 787 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 788 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 789 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "use crate::minusplus::MinusPlus;".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 790 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 791 |
}) |
| 792 |
); |
| 793 |
|
| 794 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 795 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 796 |
"src/con-fig.rs: pub line_numbers_style_minusplus: MinusPlus<Style>," |
| 797 |
), |
| 798 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 799 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 800 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/con-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 801 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 802 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 803 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub line_numbers_style_minusplus: MinusPlus<Style>,".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 804 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 805 |
}) |
| 806 |
); |
| 807 |
|
| 808 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 809 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 810 |
"src/de lta.rs:pub fn delta<I>(lines: ByteLines<I>, writer: &mut dyn Write, config: &Config) -> std::io::Result<()>" |
| 811 |
), |
| 812 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 813 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 814 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/de lta.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 815 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 816 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 817 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "pub fn delta<I>(lines: ByteLines<I>, writer: &mut dyn Write, config: &Config) -> std::io::Result<()>".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 818 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 819 |
}) |
| 820 |
); |
| 821 |
|
| 822 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 823 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 824 |
"src/de lta.rs: pub fn new(writer: &'a mut dyn Write, config: &'a Config) -> Self {" |
| 825 |
), |
| 826 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 827 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 828 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/de lta.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 829 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 830 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 831 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub fn new(writer: &'a mut dyn Write, config: &'a Config) -> Self {".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 832 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 833 |
}) |
| 834 |
); |
| 835 |
} |
| 836 |
|
| 837 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 838 |
fn test_parse_grep_n_matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_n_match().() { |
| 839 |
let fake_parent_grep_command = |
| 840 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 841 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 842 |
|
| 843 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 844 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/co-7-fig.rs:7:xxx"), |
| 845 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 846 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 847 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/co-7-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 848 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(7), |
| 849 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 850 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 851 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 852 |
}) |
| 853 |
); |
| 854 |
|
| 855 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 856 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs:21:use crate::minusplus::MinusPlus;"), |
| 857 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 858 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 859 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 860 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(21), |
| 861 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 862 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "use crate::minusplus::MinusPlus;".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 863 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 864 |
}) |
| 865 |
); |
| 866 |
|
| 867 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 868 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 869 |
"src/config.rs:95: pub line_numbers_style_minusplus: MinusPlus<Style>," |
| 870 |
), |
| 871 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 872 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 873 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 874 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(95), |
| 875 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 876 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub line_numbers_style_minusplus: MinusPlus<Style>,".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 877 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 878 |
}) |
| 879 |
); |
| 880 |
|
| 881 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 882 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("Makefile:10:test: unit-test end-to-end-test"), |
| 883 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 884 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 885 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "Makefile".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 886 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(10), |
| 887 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 888 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "test: unit-test end-to-end-test".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 889 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 890 |
}) |
| 891 |
); |
| 892 |
|
| 893 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 894 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().( |
| 895 |
"Makefile:16: ./tests/test_raw_output_matches_git_on_full_repo_history" |
| 896 |
), |
| 897 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 898 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 899 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "Makefile".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 900 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(16), |
| 901 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 902 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " ./tests/test_raw_output_matches_git_on_full_repo_history".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 903 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 904 |
}) |
| 905 |
); |
| 906 |
} |
| 907 |
|
| 908 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 909 |
#[ignore] |
| 910 |
fn test_parse_grep_n_match_file_name_with_dashes_and_no_extensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_n_match_file_name_with_dashes_and_no_extension().() { |
| 911 |
// git grep -n |
| 912 |
// This fails: we can't parse it currently. |
| 913 |
let fake_parent_grep_command = |
| 914 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 915 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 916 |
|
| 917 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 918 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("etc/examples/119-within-line-edits:4:repo=$(mktemp -d)"), |
| 919 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 920 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 921 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "etc/examples/119-within-line-edits".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 922 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4), |
| 923 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 924 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "repo=$(mktemp -d)".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 925 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 926 |
}) |
| 927 |
); |
| 928 |
} |
| 929 |
|
| 930 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 931 |
fn test_parse_grep_n_match_directory_name_with_dashesrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_n_match_directory_name_with_dashes().() { |
| 932 |
let fake_parent_grep_command = |
| 933 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 934 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 935 |
|
| 936 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 937 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("etc/META-INF/foo.properties:4:value=hi-there"), |
| 938 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 939 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 940 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "etc/META-INF/foo.properties".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 941 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(4), |
| 942 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 943 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "value=hi-there".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 944 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 945 |
}) |
| 946 |
); |
| 947 |
} |
| 948 |
|
| 949 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 950 |
fn test_parse_grep_colorrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_color().() { |
| 951 |
let fake_parent_grep_command = |
| 952 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 953 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 954 |
|
| 955 |
let e = "\x1B"; |
| 956 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 957 |
parse_raw_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_raw_grep_line().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 958 |
r#"{e}[35msrc/zlib-ng/configure{e}[m{e}[36m:{e}[m -a*=* | -{e}[1;32m-arch{e}[ms=*) ARCHS=$(echo $1 | sed 's/.*=//'); shift ;;"# |
| 959 |
)), |
| 960 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 961 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 962 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/zlib-ng/configure".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 963 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 964 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 965 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#" -a*=* | --archs=*) ARCHS=$(echo $1 | sed 's/.*=//'); shift ;;"#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 966 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 967 |
}) |
| 968 |
); |
| 969 |
|
| 970 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 971 |
parse_raw_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_raw_grep_line().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 972 |
r#"{e}[35msrc/zlib-ng/configure{e}[m{e}[36m:{e}[m{e}[32m214{e}[m{e}[36m:{e}[m -a*=* | -{e}[1;32m-arch{e}[ms=*) ARCHS=$(echo $1 | sed 's/.*=//'); shift ;;"# |
| 973 |
)), |
| 974 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 975 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 976 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/zlib-ng/configure".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 977 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(214), |
| 978 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 979 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#" -a*=* | --archs=*) ARCHS=$(echo $1 | sed 's/.*=//'); shift ;;"#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 980 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 981 |
}) |
| 982 |
); |
| 983 |
} |
| 984 |
|
| 985 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 986 |
fn test_parse_grep_no_matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_no_match().() { |
| 987 |
let fake_parent_grep_command = |
| 988 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 989 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 990 |
|
| 991 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 992 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/co-7-fig.rs-xxx"), |
| 993 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 994 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 995 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/co-7-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 996 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 997 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 998 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 999 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1000 |
}) |
| 1001 |
); |
| 1002 |
|
| 1003 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1004 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs- pub available_terminal_width: usize,"), |
| 1005 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1006 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1007 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1008 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1009 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1010 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub available_terminal_width: usize,".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1011 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1012 |
}) |
| 1013 |
); |
| 1014 |
|
| 1015 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1016 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/con-fig.rs-use crate::minusplus::MinusPlus;"), |
| 1017 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1018 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1019 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/con-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1020 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1021 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1022 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "use crate::minusplus::MinusPlus;".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1023 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1024 |
}) |
| 1025 |
); |
| 1026 |
|
| 1027 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1028 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("de-lta.rs- if self.source == Source::Unknown {"), |
| 1029 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1030 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1031 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "de-lta.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1032 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1033 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1034 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " if self.source == Source::Unknown {".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1035 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1036 |
}) |
| 1037 |
); |
| 1038 |
|
| 1039 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1040 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(r#"aaa/bbb.scala- s"xxx.yyy.zzz: $ccc ddd""#), |
| 1041 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1042 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1043 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "aaa/bbb.scala".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1044 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1045 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1046 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#" s"xxx.yyy.zzz: $ccc ddd""#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1047 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1048 |
}) |
| 1049 |
); |
| 1050 |
|
| 1051 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1052 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(r#"aaa/bbb.scala- val atRegex = Regex.compile("(@.*)|(-shdw@.*)""#), |
| 1053 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1054 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1055 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "aaa/bbb.scala".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1056 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1057 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1058 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#" val atRegex = Regex.compile("(@.*)|(-shdw@.*)""#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1059 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1060 |
}) |
| 1061 |
); |
| 1062 |
} |
| 1063 |
|
| 1064 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1065 |
fn test_parse_grep_n_no_matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_n_no_match().() { |
| 1066 |
// git grep -n |
| 1067 |
let fake_parent_grep_command = |
| 1068 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1069 |
|
| 1070 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 1071 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1072 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/co-7-fig.rs-7-xxx"), |
| 1073 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1074 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1075 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/co-7-fig.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1076 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(7), |
| 1077 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1078 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1079 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1080 |
}) |
| 1081 |
); |
| 1082 |
|
| 1083 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1084 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs-58- pub available_terminal_width: usize,"), |
| 1085 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1086 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1087 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1088 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(58), |
| 1089 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1090 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: " pub available_terminal_width: usize,".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1091 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1092 |
}) |
| 1093 |
); |
| 1094 |
|
| 1095 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1096 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(r#"foo.rs-12- .x-"#), |
| 1097 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1098 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1099 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "foo.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1100 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(12), |
| 1101 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1102 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#" .x-"#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1103 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1104 |
}) |
| 1105 |
); |
| 1106 |
|
| 1107 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1108 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(r#"foo.rs-12-.x-"#), |
| 1109 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1110 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1111 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "foo.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1112 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(12), |
| 1113 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Contextrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Context#, |
| 1114 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: r#".x-"#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1115 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1116 |
}) |
| 1117 |
); |
| 1118 |
} |
| 1119 |
|
| 1120 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1121 |
fn test_parse_grep_match_no_extensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_match_no_extension().() { |
| 1122 |
let fake_parent_grep_command = |
| 1123 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1124 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1125 |
|
| 1126 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1127 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("Makefile:xxx"), |
| 1128 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1129 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1130 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "Makefile".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1131 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1132 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 1133 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1134 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1135 |
}) |
| 1136 |
); |
| 1137 |
} |
| 1138 |
|
| 1139 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1140 |
fn test_parse_grep_n_match_no_extensionrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_n_match_no_extension().() { |
| 1141 |
// git grep -n |
| 1142 |
let fake_parent_grep_command = |
| 1143 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1144 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1145 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1146 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("Makefile:7:xxx"), |
| 1147 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1148 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1149 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "Makefile".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1150 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(7), |
| 1151 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::Matchrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#Match#, |
| 1152 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "xxx".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1153 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1154 |
}) |
| 1155 |
); |
| 1156 |
} |
| 1157 |
|
| 1158 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1159 |
#[allow(non_snake_case)] |
| 1160 |
fn test_parse_grep_W_context_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_W_context_header().() { |
| 1161 |
// git grep -W |
| 1162 |
let fake_parent_grep_command = |
| 1163 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1164 |
|
| 1165 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1166 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1167 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs=pub struct Config {"), // match |
| 1168 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1169 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1170 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1171 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1172 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader#, |
| 1173 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "pub struct Config {".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1174 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1175 |
}) |
| 1176 |
); |
| 1177 |
} |
| 1178 |
|
| 1179 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1180 |
#[allow(non_snake_case)] |
| 1181 |
fn test_parse_grep_W_n_context_headerrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_W_n_context_header().() { |
| 1182 |
// git grep -n -W |
| 1183 |
let fake_parent_grep_command = |
| 1184 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1185 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1186 |
|
| 1187 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1188 |
parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().("src/config.rs=57=pub struct Config {"), |
| 1189 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(GrepLinerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine# { |
| 1190 |
grep_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#grep_type.: GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#::Classicrust-analyzer cargo git-delta 0.19.2 config/GrepType#Classic#, |
| 1191 |
pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path.: "src/config.rs".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1192 |
line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(57), |
| 1193 |
line_typerust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_type.: LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#::ContextHeaderrust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#ContextHeader#, |
| 1194 |
coderust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#code.: "pub struct Config {".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 1195 |
submatchesrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#submatches.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 1196 |
}) |
| 1197 |
); |
| 1198 |
} |
| 1199 |
|
| 1200 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1201 |
fn test_parse_grep_not_grep_outputrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_not_grep_output().() { |
| 1202 |
let fake_parent_grep_command = |
| 1203 |
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1204 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1205 |
|
| 1206 |
let not_grep_output = "| expose it in delta's color output styled with grep:"; |
| 1207 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(not_grep_output), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1208 |
} |
| 1209 |
|
| 1210 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1211 |
fn test_parse_grep_parent_command_is_not_grep_1rust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_parent_command_is_not_grep_1().() { |
| 1212 |
let fake_parent_grep_command = |
| 1213 |
"/usr/local/bin/notgrep --doesnt-matter --nor-this nor_this -- nor_this"; |
| 1214 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::oncerust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]once().(fake_parent_grep_command); |
| 1215 |
|
| 1216 |
let apparently_grep_output = "src/co-7-fig.rs:xxx"; |
| 1217 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(apparently_grep_output), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1218 |
} |
| 1219 |
|
| 1220 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1221 |
fn test_parse_grep_parent_command_is_not_grep_2rust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_parse_grep_parent_command_is_not_grep_2().() { |
| 1222 |
// No fake parent grep command |
| 1223 |
let apparently_grep_output = "src/co-7-fig.rs:xxx"; |
| 1224 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(apparently_grep_output), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1225 |
} |
| 1226 |
|
| 1227 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1228 |
fn test_get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/tests/test_get_code_style_sections().() { |
| 1229 |
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().; |
| 1230 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::greprust-analyzer cargo git-delta 0.19.2 handlers/grep/::get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().; |
| 1231 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/::StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#; |
| 1232 |
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#; |
| 1233 |
|
| 1234 |
let fake_parent_grep_command = "git --doesnt-matter grep --nor-this nor_this -- nor_this"; |
| 1235 |
let _args = FakeParentArgsrust-analyzer cargo git-delta 0.19.2 utils/process/tests/FakeParentArgs#::for_scoperust-analyzer cargo git-delta 0.19.2 utils/process/tests/impl#[FakeParentArgs]for_scope().(fake_parent_grep_command); |
| 1236 |
|
| 1237 |
let miss = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().(); |
| 1238 |
let hit = Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 1239 |
is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph.: true, |
| 1240 |
..miss |
| 1241 |
}; |
| 1242 |
|
| 1243 |
let escape = "\x1B"; |
| 1244 |
let working_example = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("foo/bar/baz.yaml{escape}[36m:{escape}[m1090{escape}[36m:{escape}[m - {escape}[1;31mkind: Service{escape}[mAccount"); |
| 1245 |
let stripped = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&working_example); |
| 1246 |
let grep = parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(&stripped).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1247 |
|
| 1248 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1249 |
get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().(&working_example, hit, miss, &grep.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., grep.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number.), |
| 1250 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::StyleSectionsrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#StyleSections#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1251 |
(miss, " - "), |
| 1252 |
(hit, "kind: Service"), |
| 1253 |
(miss, "Account") |
| 1254 |
])) |
| 1255 |
); |
| 1256 |
|
| 1257 |
let broken_example = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("foo/bar/baz.yaml{escape}[36m:{escape}[m2{escape}[36m:{escape}[m{escape}[1;31mkind: Service{escape}[m"); |
| 1258 |
let broken_stripped = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&broken_example); |
| 1259 |
let broken_grep = parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(&broken_stripped).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1260 |
|
| 1261 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1262 |
get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().( |
| 1263 |
&broken_example, |
| 1264 |
hit, |
| 1265 |
miss, |
| 1266 |
&broken_grep.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 1267 |
broken_grep.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number. |
| 1268 |
), |
| 1269 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::StyleSectionsrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#StyleSections#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![( |
| 1270 |
hit, |
| 1271 |
"kind: Service" |
| 1272 |
)])) |
| 1273 |
); |
| 1274 |
|
| 1275 |
let plus_example = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("etc/examples/189-merge-conflict.2.diff{escape}[36m:{escape}[m10{escape}[36m:{escape}[m{escape}[32m + let (style, non_emph_style) = {escape}[1;31mmatch{escape}[m state {{{escape}[m"); |
| 1276 |
let plus_stripped = strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&plus_example); |
| 1277 |
let plus_grep = parse_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/parse_grep_line().(&plus_stripped).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1278 |
|
| 1279 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1280 |
get_code_style_sectionsrust-analyzer cargo git-delta 0.19.2 handlers/grep/get_code_style_sections().( |
| 1281 |
&plus_example, |
| 1282 |
hit, |
| 1283 |
miss, |
| 1284 |
&plus_grep.pathrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#path., |
| 1285 |
plus_grep.line_numberrust-analyzer cargo git-delta 0.19.2 handlers/grep/GrepLine#line_number. |
| 1286 |
), |
| 1287 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::StyleSectionsrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#StyleSections#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1288 |
(miss, " + let (style, non_emph_style) = "), |
| 1289 |
(hit, "match"), |
| 1290 |
(miss, " state {") |
| 1291 |
])) |
| 1292 |
); |
| 1293 |
} |
| 1294 |
} |