Open
Bug 1616761
Opened 5 years ago
Updated 2 years ago
./mach lint -l clippy doesn't work correct on some rust code
Categories
(Developer Infrastructure :: Lint and Formatting, defect, P3)
Developer Infrastructure
Lint and Formatting
Tracking
(Not tracked)
NEW
People
(Reporter: Sylvestre, Assigned: Sylvestre)
References
Details
With the diff
diff --git a/mozglue/static/rust/lib.rs b/mozglue/static/rust/lib.rs
--- a/mozglue/static/rust/lib.rs
+++ b/mozglue/static/rust/lib.rs
@@ -17,16 +17,22 @@ extern "C" {
}
/// Truncate a string at the closest unicode character boundary
/// ```
/// assert_eq!(str_truncate_valid("éà", 3), "é");
/// assert_eq!(str_truncate_valid("éà", 4), "éè");
/// ```
fn str_truncate_valid(s: &str, mut mid: usize) -> &str {
+ let mut a=1;
+ let mut b=1;
+
+ a = b;
+ b = a;
+
loop {
if let Some(res) = s.get(..mid) {
return res;
}
mid -= 1;
}
}
Warnings are clearly detected by the compiler
0:04.07 Compiling mozglue-static v0.1.0 (/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust)
0:04.19 warning: value assigned to `a` is never read
0:04.19 --> mozglue/static/rust/lib.rs:25:13
0:04.19 |
0:04.19 25 | let mut a=1;
0:04.19 | ^
0:04.19 |
but ./mach lint -l clippy fails to report any issue:
% ./mach lint -l clippy mozglue/static/rust/lib.rs -v
09:02:38.862 clippy (2174047) | Passing the following paths:
/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust/lib.rs
09:02:38.891 clippy (2174047) | Path = /home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust/lib.rs
09:02:38.891 clippy (2174047) | Path translated to = /home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust/Cargo.toml
09:02:38.891 clippy (2174047) | Command: ['/home/sylvestre/.cargo/bin/cargo', 'clean', '--manifest-path', '/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust/Cargo.toml']
09:02:38.938 clippy (2174047) | Command: ['/home/sylvestre/.cargo/bin/cargo', 'clippy', '--message-format=json', '--manifest-path', '/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust/Cargo.toml']
09:02:42.862 clippy (2174047) | Could not parse the output:
09:02:42.863 clippy (2174047) | clippy output: b' Compiling cc v1.0.47'
09:02:42.863 clippy (2174047) | Could not parse the output:
09:02:42.863 clippy (2174047) | clippy output: b' Checking arrayvec v0.5.1'
09:02:42.863 clippy (2174047) | Could not parse the output:
09:02:42.863 clippy (2174047) | clippy output: b' Compiling mozglue-static v0.1.0 (/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust)'
09:02:42.863 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b'error: failed to run custom build command for `mozglue-static v0.1.0 (/home/sylvestre/dev/mozilla/autoland.hg/mozglue/static/rust)`'
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b''
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b'Caused by:'
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b" process didn't exit successfully: `/home/sylvestre/dev/mozilla/autoland.hg/target/debug/build/mozglue-static-0a8c877e8e3fa413/build-script-build` (exit code: 101)"
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b'--- stderr'
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b"thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/macros/mod.rs:15:40"
09:02:42.864 clippy (2174047) | Could not parse the output:
09:02:42.864 clippy (2174047) | clippy output: b'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.'
09:02:42.865 clippy (2174047) | Could not parse the output:
09:02:42.865 clippy (2174047) | clippy output: b''
09:02:42.865 clippy (2174047) | Finished in 4.09 seconds
✖ 0 problems (0 errors, 0 warnings)
Updated•5 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•