lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72ntFkvN983N3x=AKMd6fW2yXb8d0LB1LT3c20oYmPCiGg@mail.gmail.com>
Date: Wed, 2 Jul 2025 14:22:48 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, alex.gaynor@...il.com, ojeda@...nel.org, 
	aliceryhl@...gle.com, anna-maria@...utronix.de, bjorn3_gh@...tonmail.com, 
	boqun.feng@...il.com, dakr@...nel.org, frederic@...nel.org, gary@...yguo.net, 
	jstultz@...gle.com, linux-kernel@...r.kernel.org, lossin@...nel.org, 
	lyude@...hat.com, rust-for-linux@...r.kernel.org, sboyd@...nel.org, 
	tglx@...utronix.de, tmgross@...ch.edu
Subject: Re: [PATCH v1] rust: time: Add examples with doctest for Delta

On Wed, Jul 2, 2025 at 10:36 AM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>
> I think this kind of test would be better suited for the new `#[test]`
> macro. Would you agree?

I don't mind seeing the edge cases, since the behavior is mentioned in
the docs, just like sometimes we show e.g. the `Err`/`None` cases in
other functions etc., and it may help to further highlight that this
can actually return possibly unexpected values.

It is also what the standard library does, at least in some similar cases, e.g.

    https://doc.rust-lang.org/std/primitive.i64.html#method.saturating_add

Maybe instead we can help making it a bit more readable, e.g. avoiding
the intermediate variable to have a single line plus using a `# use
Delta` to further reduce the line length?

Also adding a newline between the "normal" case and the saturation
cases would probably help too.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ