Files
rust/tests/ui/parser/ufcs-return-unused-parens.fixed

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
523 B
Rust
Raw Normal View History

2025-07-01 02:46:47 +05:00
//! Check that UFCS syntax works correctly in return statements
//! without requiring workaround parentheses.
//!
//! Regression test for <https://github.com/rust-lang/rust/issues/37765>.
2020-07-02 14:32:12 +09:00
//@ run-pass
//@ run-rustfix
#![allow(dead_code)]
#![warn(unused_parens)]
fn with_parens<T: ToString>(arg: T) -> String {
2025-07-01 02:46:47 +05:00
return <T as ToString>::to_string(&arg); //~ WARN unnecessary parentheses around `return` value
2020-07-02 14:32:12 +09:00
}
fn no_parens<T: ToString>(arg: T) -> String {
return <T as ToString>::to_string(&arg);
}
fn main() {}