Skip to content

Commit 73326c1

Browse files
authored
Merge pull request #397 from AaronKutch/float_refactor
2 parents 130acba + d662521 commit 73326c1

File tree

21 files changed

+449
-1772
lines changed

21 files changed

+449
-1772
lines changed

.github/workflows/main.yml

+16-2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ jobs:
109109
- uses: actions/checkout@v1
110110
with:
111111
submodules: true
112-
- name: Install Rust
113-
run: rustup update stable && rustup default stable && rustup component add rustfmt
112+
- name: Install stable `rustfmt`
113+
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
114114
- run: cargo fmt -- --check
115+
116+
clippy:
117+
name: Clippy
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v1
121+
with:
122+
submodules: true
123+
# Unlike rustfmt, stable clippy does not work on code with nightly features.
124+
# This acquires the most recent nightly with a clippy component.
125+
- name: Install nightly `clippy`
126+
run: |
127+
rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
128+
- run: cargo clippy -- -D clippy::all

crates/panic-handler/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Hack of a crate until rust-lang/rust#51647 is fixed
1+
//! This is needed for tests on targets that require a `#[panic_handler]` function
22
33
#![feature(no_core)]
44
#![no_core]

src/float/add.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ where
137137
a_significand <<= shift;
138138
a_exponent -= shift;
139139
}
140-
} else
141-
/* addition */
142-
{
140+
} else {
141+
// addition
143142
a_significand += b_significand;
144143

145144
// If the addition carried up, we need to right-shift the result and

src/float/cmp.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,22 @@ fn cmp<F: Float>(a: F, b: F) -> Result {
6363
// a and b as signed integers as we would with a fp_ting-point compare.
6464
if a_srep & b_srep >= szero {
6565
if a_srep < b_srep {
66-
return Result::Less;
66+
Result::Less
6767
} else if a_srep == b_srep {
68-
return Result::Equal;
68+
Result::Equal
6969
} else {
70-
return Result::Greater;
70+
Result::Greater
7171
}
72-
}
7372
// Otherwise, both are negative, so we need to flip the sense of the
7473
// comparison to get the correct result. (This assumes a twos- or ones-
7574
// complement integer representation; if integers are represented in a
7675
// sign-magnitude representation, then this flip is incorrect).
77-
else {
78-
if a_srep > b_srep {
79-
return Result::Less;
80-
} else if a_srep == b_srep {
81-
return Result::Equal;
82-
} else {
83-
return Result::Greater;
84-
}
76+
} else if a_srep > b_srep {
77+
Result::Less
78+
} else if a_srep == b_srep {
79+
Result::Equal
80+
} else {
81+
Result::Greater
8582
}
8683
}
8784

0 commit comments

Comments
 (0)