Skip to content

Commit

Permalink
span: allow ambiguous_negative_literals
Browse files Browse the repository at this point in the history
This was bad timing. The lang team just stabilized (in nightly) a new
deny-by-default lint, named `ambiguous_negative_literals`, which
triggers an error for things like `-1.hour()`. While such things can be
confusingly ambiguous in some cases, in Jiff, `-1.hour()`, `(-1).hour()`
and `-(1.hour())` are all, very intentionally, precisely equivalent.

For now we just `allow` the lint. If the lint stays, we'll likely want
to recommend allowing it in the Jiff docs.

See: rust-lang/rust#121364
  • Loading branch information
BurntSushi committed Jul 27, 2024
1 parent 3c3b810 commit 75ad0f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ specifiers and other APIs.
#![warn(missing_debug_implementations)]
// Document ALL THE THINGS!
#![deny(missing_docs)]
// See: https://github.com/rust-lang/rust/pull/121364
#![allow(ambiguous_negative_literals)]

// It should be possible to support other pointer widths, but this library
// hasn't been tested nor thought about much in contexts with pointers less
Expand Down
3 changes: 3 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// See: https://github.com/rust-lang/rust/pull/121364
#![allow(ambiguous_negative_literals)]

mod tc39_262;

0 comments on commit 75ad0f8

Please sign in to comment.