Skip to content

Long trait impl line is poorly formatted #1163

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

Closed
Apanatshka opened this issue Sep 18, 2016 · 2 comments
Closed

Long trait impl line is poorly formatted #1163

Apanatshka opened this issue Sep 18, 2016 · 2 comments

Comments

@Apanatshka
Copy link

I manually formatted this code as:

impl<'i, 'a, Input, Payload, A: Automaton<Input, Payload>>
    Iterator for Matches<'i, 'a, Input, Payload, A>
{
    type Item = Match<Payload>;

    fn next(&mut self) -> Option<Self::Item> {
        let mut offset = self.offset;
        while offset < self.input.len() {
            self.state = self.aut.next_state(&self.state, &self.input[offset]);
            offset += 1;
            if let Some(m) = self.aut.get_match(&self.state, 0) {
                self.offset = offset;
                return Some(m);
            }
        }
        None
    }
}

rustfmt --write-mode=diff:

-impl<'i, 'a, Input, Payload, A: Automaton<Input, Payload>>⏎
-    Iterator for Matches<'i, 'a, Input, Payload, A>⏎
-{⏎
+impl<'i, 'a, Input, Payload, A: Automaton<Input, Payload>> Iterator for Matches<'i,⏎
+                                                                                'a,⏎
+                                                                                Input,⏎
+                                                                                Payload,⏎
+                                                                                A> {⏎
@sinkuu
Copy link
Contributor

sinkuu commented Sep 18, 2016

Try newer version of rustfmt. This have been fixed by #1148

@Apanatshka
Copy link
Author

Derp, totally forgot to check for updates 😅 You're right, it's fixed already.

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

2 participants