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

Changing display format to a more compact form. #96

Closed
ErikBuer opened this issue Sep 19, 2021 · 2 comments
Closed

Changing display format to a more compact form. #96

ErikBuer opened this issue Sep 19, 2021 · 2 comments

Comments

@ErikBuer
Copy link

Hi,
I am new to Rust, and open source contribution, so please bear with me..

When debugging arrays of complex numbers i find the formatting to be unnecessarily long, making it hard to see what is going on in the data. See the example below.

I therefore propose to change the debug and display formatting to a+bi, e.g. 1+2i.

Note that in the example below, Github doesn't wrap the line.

stderr:
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `[Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }, Complex { re: 1, im: 0 }]`,
 right: `[Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }, Complex { re: 0, im: 0 }]`', src/lib.rs:13:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Erik.

@cuviper
Copy link
Member

cuviper commented Apr 26, 2022

Display should already have that compact form, but there's a reasonable case to be made for Debug as well. We did make that change for BigInt and BigUint in rust-num/num-bigint#195, but it's somewhat debatable whether that should be considered a breaking change. In that case, I was getting ready for a semver bump anyway.

@ErikBuer
Copy link
Author

Yes, I see now.
I appreciate the feedback!

Erik.

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

No branches or pull requests

2 participants