Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes macros need parentheses to call a method on their output, and sometimes not #17082

Closed
japaric opened this issue Sep 7, 2014 · 1 comment

Comments

@japaric
Copy link
Member

japaric commented Sep 7, 2014

STR

use std::io::MemWriter;

fn main() {
    let ref mut sink = MemWriter::new();
    match Some(true) {
        Some(_) => writeln!(sink, "Doesn't need parentheses").unwrap(),
        None => {},
    }
    writeln!(sink, "Needs parentheses!").unwrap();  //~ ERROR: unexpected token `.`
}

Version

rustc 0.12.0-pre (a356e9880 2014-09-06 10:31:29 +0000)

This feels inconsistent to me, I think we should stick to either making the parenthesis mandatory, or making the parentheses totally optional. In other words, in the above example, either both writeln! expressions should be rejected, or both should be accepted.

@bluss
Copy link
Member

bluss commented Sep 7, 2014

dup of #5941

@sfackler sfackler closed this as completed Sep 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants