Commit Graph

16 Commits

Author SHA1 Message Date
Dan Davison
084a6d19b2 Accept clippy suggestions (#1632) 2024-02-19 12:56:22 -05:00
nickelc
28bf556897 Fix clippy warnings (#1298)
* Fix clippy warnings

- `clippy::uninlined_format_args`

* Fix clippy warnings

- `clippy::clone_on_copy`
- `clippy::explicit_auto_deref`
- `clippy::iter_cloned_collect`
- `clippy::map_clone`
- `clippy::needless_borrow`
- `clippy::needless_lifetimes`
- `clippy::needless_return`
- `clippy::redundant_clone`
- `clippy::redundant_field_names`
- `clippy::seek_to_start_instead_of_rewind`
- `clippy::unnecessary_cast`
- `clippy::unused_unit`
2023-02-28 06:37:20 -05:00
mliszcz
b99e6c5d9c Fix clippy warnings after rust 1.63 upgrade
Following fixes are included:

* derive_partial_eq_without_eq:
  Eq trait was added by running `cargo clippy --fix --no-deps`.
* get_first:
  Function was replaced by running `cargo clippy --fix --no-deps`.
* unnecessary_to_owned:
  This check was disabled for ANSIString as to_string call is required
  to enforce formatting. Otherwise the underlying string was returned
  directly (probably due to Deref implementation).
* type_complexity:
  Closure type was simplified and Box<> usage was removed.
2022-08-16 18:17:10 -04:00
Kian-Meng Ang
738c5a141b Fix typos (#1151)
Found via following command:

    codespell -L crate,nin,numer,struc,ded,fo
2022-08-07 10:42:36 -04:00
Thomas Otto
64258ccef2 Placeholder may contain a type field
Similar to Pythons `{n:2.1f}` where f indicates a floating point type.
The type may be separated by an underscore: `{n:<15.14_type}`.

Add a FormatStringPlaceholderDataAnyPlaceholder template which works
without a borrowed Placeholder.
2022-01-21 03:15:35 -05:00
Thomas Otto
3aed51cdc1 Center Align numbers right-ish (#883)
There is no such thing as "Center Align" with discrete terminal cells. In
some cases a decision has to be made whether to use the left or the right
cell, e.g. when centering one char in 4 cells: "_X__" or "__X_".

The format!() center/^ default is left, but when padding numbers these
are now aligned to the right if required. Strings remain left-aligned.
2022-01-18 19:33:09 -05:00
Dan Davison
57cabdcb65 Support precision specifier in run-time format strings 2021-11-15 21:01:32 -05:00
Thomas Otto
59e8908f82 Fix side-by-side mode without line numbers
Even though this feature enables line numbers, these can be disabled via
the git config `delta.line-numbers=false`. So always enable line numbers,
even if they do not print numbers.

Construct more structs with ..Self::default()
2021-10-26 18:05:30 -04:00
Thomas Otto
5762a527a7 Re-enable ANSI fill by equalizing panel sizes
Make the two panels in side-by-side use the full terminal width by
inserting an extra space in the center between the panels if the
width is odd and ANSI filling is enabled.

Fall back to spaces when the output is not to a terminal.
2021-10-25 18:29:43 -04:00
Thomas Otto
3a03d4b5ee Convert Align and Placeholder into enums
Also move number and style logic out of `format_and_paint_line_numbers()`
and into a separate `linenumbers_and_styles()` function.
2021-10-18 10:41:12 -04:00
Thomas Otto
cd50d30184 Store line number prefix/suffix as SmolStr 2021-10-18 10:41:12 -04:00
Thomas Otto
ebd008c364 Add line number width calculation 2021-10-16 14:07:30 +02:00
Dan Davison
6afd3705d8 Refactor: module for working with format strings 2021-08-28 21:36:57 -04:00
Dan Davison
23e88e5567 Refactor: eliminate format module 2021-08-28 21:36:57 -04:00
Marco Ieni
b14942527a remove some clippy warnings (#383)
* remove some clippy warnings

* revert comparison_chain clippy lint

Allow it locally
2020-11-07 13:48:02 -05:00
Dan Davison
b2257cfae7 Format files and commits as OSC 8 hyperlinks
Closes #257
2020-07-22 17:57:57 -04:00