-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessarily Cloning, structuring #1905
base: main
Are you sure you want to change the base?
Changes from 9 commits
1ed8f20
530cb6b
1d5bf88
139b480
949145d
44fa279
38ca301
720adb6
97d166e
4f3981d
630e622
f0b52c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,15 +233,15 @@ $ | |
pub fn parse_git_blame_line<'a>(line: &'a str, timestamp_format: &str) -> Option<BlameLine<'a>> { | ||
let caps = BLAME_LINE_REGEX.captures(line)?; | ||
|
||
let commit = caps.get(1).unwrap().as_str(); | ||
let author = caps.get(2).unwrap().as_str(); | ||
let timestamp = caps.get(3).unwrap().as_str(); | ||
let commit = caps.get(1)?.as_str(); | ||
let author = caps.get(2)?.as_str(); | ||
let timestamp = caps.get(3)?.as_str(); | ||
|
||
let time = DateTime::parse_from_str(timestamp, timestamp_format).ok()?; | ||
|
||
let line_number = caps.get(4).unwrap().as_str().parse::<usize>().ok()?; | ||
let line_number = caps.get(4)?.as_str().parse::<usize>().ok()?; | ||
|
||
let code = caps.get(5).unwrap().as_str(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
should we reverting this changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think the only bit of the PR that arguably should be retained is not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could create and tag issues as 🟣 good first issue for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review, corrected |
||
let code = caps.get(5)?.as_str(); | ||
|
||
Some(BlameLine { | ||
commit, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ pub fn set_options( | |
} | ||
opt.navigate = opt.navigate || opt.env.navigate.is_some(); | ||
if opt.syntax_theme.is_none() { | ||
opt.syntax_theme.clone_from(&opt.env.bat_theme); | ||
opt.syntax_theme = opt.env.bat_theme.take(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While there might be an efficiency saving here, it makes the data inconsistent, so I think we should only make changes like that for demonstrated performance wins. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, i see, thanks |
||
} | ||
|
||
let option_names = cli::Opt::get_argument_and_option_names(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind reverting this change? It loses the "joint distribution" of the data: i.e. it's not as obvious from the new code that, for example, they will either both be 0 or neither be 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, corrected