diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/ui/lint/unused/issue-103320-must-use-ops.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/unused/issue-103320-must-use-ops.rs')
-rw-r--r-- | tests/ui/lint/unused/issue-103320-must-use-ops.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/lint/unused/issue-103320-must-use-ops.rs b/tests/ui/lint/unused/issue-103320-must-use-ops.rs new file mode 100644 index 000000000..597d312fa --- /dev/null +++ b/tests/ui/lint/unused/issue-103320-must-use-ops.rs @@ -0,0 +1,27 @@ +// check-pass + +#![warn(unused_must_use)] +#![feature(never_type)] + +use std::ops::Add; +use std::ops::Sub; +use std::ops::Mul; +use std::ops::Div; +use std::ops::Rem; + +fn main() { + let x = 2_u32; + (x.add(4), x.sub(4), x.mul(4), x.div(4), x.rem(4)); + + x.add(4); //~ WARN unused return value of `add` that must be used + + x.sub(4); //~ WARN unused return value of `sub` that must be used + + x.mul(4); //~ WARN unused return value of `mul` that must be used + + x.div(4); //~ WARN unused return value of `div` that must be used + + x.rem(4); //~ WARN unused return value of `rem` that must be used + + println!("{}", x); +} |