Commit graph

21 commits

Author SHA1 Message Date
Manish Goregaokar
ddae7e6f41 Correct safety docs 2024-01-02 17:22:34 -08:00
Alex Crichton
9a9aabc178 refactor: Reduce code size of testing tokens if they're a number
This commit is a tiny win in compiled code size of a final binary
including `clap` which shaves off 19k of compiled code locally.
Previously tokens were checked if they were a number by using
`.parse::<f64>().is_ok()`, but parsing floats is relatively heavyweight
in terms of code size. This replaces the check with a more naive "does
this string have lots of ascii digits" check where the compiled size of
this check should be much smaller.
2023-10-24 09:17:45 -07:00
Ed Page
3db3524943 fix(lex)!: Remove unsafe safe method 2023-05-19 11:29:50 -05:00
Yuri Astrakhan
d0302c5556 chore: Inline simple non-mixed format args 2023-05-04 15:58:04 -04:00
Ed Page
73e40258ca fix(lex): Clarify unsafe safety
This is a followup to comments on #4802
2023-03-28 00:18:53 -05:00
Ed Page
48dc66f652 fix(clap_lex): Deprecate unsound OsStrExt::split_at 2023-03-27 23:32:30 -05:00
Ed Page
56dc953617 doc(lex): Clarify safety of unsafe 2023-03-27 23:26:41 -05:00
Ed Page
ea4dada1e4 fix(lex): Allow reporting errors for non-UTF8 longs 2023-03-25 03:42:04 -05:00
Ed Page
6419a0d937 perf!(lex): Build faster by removing os_str_bytes
We are doing direct transmutes between `OsStr` and `[u8]`.
https://github.com/rust-lang/rust/pull/95290 would make this natively
supported but I got tired of waitin for it.

This only saves about 1/4s off of `cargo build`.

This took 2.9 KiB off of `cargo bloat --release --example git`
2023-03-25 01:59:24 -05:00
Ed Page
44782c7f71 docs(lex): Don't elide content 2023-02-23 11:18:51 -06:00
Ed Page
85f541d789 fix: Switch to owned types
Impact:
- Binary size: 556.6 KiB to 578.4 KiB
- build time: 6.4950 us (7% slower)
- parse time: 7.7256 us
- parse sc time: 8.1580 us (5% faster)

Fixes #1041
Fixes #2150
2022-08-22 14:55:55 -05:00
Ed Page
772c5e3821 feat(lex): Allow checking if at end of input 2022-05-16 15:08:47 -05:00
Ed Page
a574f226eb feat(complete): Look up partial matches 2022-04-27 15:49:58 -05:00
Ed Page
f083ef92c5 fix(lex)!: Don't do prefix matching by default
Finding this a pain in `clap_complete`; not offering the benefits I
expected.
2022-04-27 12:38:12 -05:00
Ed Page
15d8b3b0cd style: Make clippy happy 2022-04-15 13:49:02 -05:00
Ed Page
2f0d91688a docs(lex): Fix links 2022-04-15 13:08:40 -05:00
Ed Page
530db327db docs(lex): Clarify context-sensitive lexing 2022-04-15 12:49:02 -05:00
Ed Page
687d361a97 docs(lex): Make a determination on to_long_stdio
This tempts me to drop our design philosophy but I want to give it more
time.
2022-04-15 12:46:09 -05:00
Ed Page
e46cf659d6 fix(lex): Provide all dat with ParsedArg::to_value 2022-04-15 12:40:05 -05:00
Ed Page
c3445e05b5 docs(lex): Provide examples 2022-04-15 11:40:49 -05:00
Ed Page
96dc6daa9e feat(lex): Pull out clap_lex 2022-04-15 10:55:37 -05:00