2018-10-06 16:18:06 +00:00
|
|
|
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
|
2018-10-11 10:16:22 +00:00
|
|
|
|
2017-09-18 10:47:33 +00:00
|
|
|
|
|
|
|
|
2018-07-28 15:34:52 +00:00
|
|
|
#![warn(clippy::double_parens)]
|
2016-12-28 18:53:33 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
fn dummy_fn<T>(_: T) {}
|
|
|
|
|
|
|
|
struct DummyStruct;
|
|
|
|
|
|
|
|
impl DummyStruct {
|
|
|
|
fn dummy_method<T>(self, _: T) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn simple_double_parens() -> i32 {
|
2017-02-08 13:58:07 +00:00
|
|
|
((0))
|
2016-12-28 18:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn fn_double_parens() {
|
2017-02-08 13:58:07 +00:00
|
|
|
dummy_fn((0));
|
2016-12-28 18:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn method_double_parens(x: DummyStruct) {
|
2017-02-08 13:58:07 +00:00
|
|
|
x.dummy_method((0));
|
2016-12-28 18:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn tuple_double_parens() -> (i32, i32) {
|
2017-02-08 13:58:07 +00:00
|
|
|
((1, 2))
|
2016-12-28 18:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn unit_double_parens() {
|
2017-02-08 13:58:07 +00:00
|
|
|
(())
|
2016-12-28 18:53:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn fn_tuple_ok() {
|
|
|
|
dummy_fn((1, 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn method_tuple_ok(x: DummyStruct) {
|
|
|
|
x.dummy_method((1, 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn fn_unit_ok() {
|
|
|
|
dummy_fn(());
|
|
|
|
}
|
|
|
|
|
|
|
|
fn method_unit_ok(x: DummyStruct) {
|
|
|
|
x.dummy_method(());
|
|
|
|
}
|
|
|
|
|
2018-09-22 15:20:34 +00:00
|
|
|
// Issue #3206
|
|
|
|
fn inside_macro() {
|
|
|
|
assert_eq!((1, 2), (1, 2), "Error");
|
|
|
|
assert_eq!(((1, 2)), (1, 2), "Error");
|
|
|
|
}
|
|
|
|
|
2016-12-28 18:53:33 +00:00
|
|
|
fn main() {}
|