Skip to content
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

feat: add --filter to filter functions shown in output #60

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

poliorcetics
Copy link
Contributor

I use this tool regularly, thanks for publishing it!

While using it, I often need to use things like cargo llvm-lines | rg my_crate::module:: to filter
the output and avoid being drowned by things I'm not (yet) trying to improve.

The default of the previous solution is that it strips the header and will still pipe the entire
output to rg when only 10% of it are useful to me.

This adds a dependency on regex, and using the tool itself:

cg r --release -- llvm-lines --filter regex
  Finished release [optimized] target(s) in 0.06s
   Running `/Users/alexis/.local/cache/cargo_target_dir/release/cargo-llvm-lines llvm-lines --filter regex`
 Compiling cargo-llvm-lines v0.4.19 (/Users/alexis/repos/tp/cargo-llvm-lines)
  Finished dev [unoptimized + debuginfo] target(s) in 0.73s
Lines                Copies              Function name
-----                ------              -------------
51076                1225                (TOTAL)
   28 (0.1%,  0.1%)     1 (0.1%,  0.1%)  core::ptr::drop_in_place<regex::exec::Exec>
   11 (0.0%,  0.1%)     1 (0.1%,  0.2%)  core::ptr::drop_in_place<core::option::Option<regex::re_unicode::Regex>>
    6 (0.0%,  0.1%)     1 (0.1%,  0.2%)  core::ptr::drop_in_place<regex::re_unicode::Regex>

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

src/main.rs Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@dtolnay dtolnay merged commit 8abeda4 into dtolnay:master Nov 8, 2022
@poliorcetics poliorcetics deleted the filter-functions branch November 8, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants