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

Rollup of 11 pull requests #84948

Closed
wants to merge 27 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c185f08
Add doc alias for `chdir` to `std::env::set_current_dir`
joshtriplett Apr 29, 2021
dd43d13
Reduce duplication in `impl_dep_tracking_hash` macros
jyn514 Apr 22, 2021
1e89b58
Account for unsatisfied bounds in E0599
estebank May 2, 2021
2e559c8
use `else if` in std library
wcampbell0x2a May 3, 2021
b4bfb0e
Update RELEASES.md for 1.52.0
XAMPPRocky Apr 14, 2021
d53469c
Clarify documentation for `[T]::contains`. Fixes #84877.
jimblandy May 3, 2021
d459b5d
platform-support: Center the contents of the `std` and `host` columns
joshtriplett May 3, 2021
389333a
Update `ptr` docs with regards to `ptr::addr_of!`
jfrimmel Mar 27, 2021
450d121
Tests for field is never read diagnostic
sunjay Mar 11, 2021
67f228e
Added suggestion and note for when a field is never used
sunjay Mar 12, 2021
715a2d4
Updating test stderr files
sunjay Mar 12, 2021
d4c1ade
Trying out a new message that works a little better for values *and* …
sunjay Mar 12, 2021
bacfc34
New shorter diagnostic note that is different for items versus fields
sunjay Mar 13, 2021
0ba2c6a
Putting help message only under the identifier that needs to be prefixed
sunjay Mar 25, 2021
ee7a6c6
Remove `rustc_middle::mir::interpret::CheckInAllocMsg::NullPointerTest`
May 4, 2021
11379f0
Do not ICE on invalid const param
estebank May 4, 2021
c0130af
Rollup merge of #83004 - sunjay:field-never-read-issue-81658, r=pnkfelix
RalfJung May 5, 2021
729338f
Rollup merge of #83553 - jfrimmel:addr-of, r=m-ou-se
RalfJung May 5, 2021
551c6f9
Rollup merge of #84183 - rust-lang:relnotes-1.52.0, r=pietroalbini
RalfJung May 5, 2021
c7b4c80
Rollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnay
RalfJung May 5, 2021
04c3e94
Rollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov
RalfJung May 5, 2021
7f7fe25
Rollup merge of #84808 - estebank:issue-84769, r=petrochenkov
RalfJung May 5, 2021
4410c28
Rollup merge of #84843 - wcampbell0x2a:use-else-if-let, r=dtolnay
RalfJung May 5, 2021
e67c8d1
Rollup merge of #84878 - jimblandy:contains-doc-fix, r=joshtriplett
RalfJung May 5, 2021
5ed95d0
Rollup merge of #84882 - joshtriplett:platform-support-formatting, r=…
RalfJung May 5, 2021
c340bf9
Rollup merge of #84903 - hyd-dev:dead-check-in-alloc-msg, r=RalfJung
RalfJung May 5, 2021
f8cbe9a
Rollup merge of #84913 - estebank:issue-84831, r=varkor
RalfJung May 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use else if in std library
Clippy: Decreases indentation and improves readability

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
  • Loading branch information
wcampbell0x2a committed May 3, 2021
commit 2e559c8e1098545582d4a72f33e73538a5e373b5
10 changes: 4 additions & 6 deletions library/core/src/time.rs
Original file line number Diff line number Diff line change
@@ -518,13 +518,11 @@ impl Duration {
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
let nanos = if self.nanos >= rhs.nanos {
self.nanos - rhs.nanos
} else if let Some(sub_secs) = secs.checked_sub(1) {
secs = sub_secs;
self.nanos + NANOS_PER_SEC - rhs.nanos
} else {
if let Some(sub_secs) = secs.checked_sub(1) {
secs = sub_secs;
self.nanos + NANOS_PER_SEC - rhs.nanos
} else {
return None;
}
return None;
};
debug_assert!(nanos < NANOS_PER_SEC);
Some(Duration { secs, nanos })