Skip to content

Fix a bunch of misc. bugs I found #245

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

Merged
merged 4 commits into from
Sep 2, 2015
Merged

Fix a bunch of misc. bugs I found #245

merged 4 commits into from
Sep 2, 2015

Conversation

nrc
Copy link
Member

@nrc nrc commented Sep 2, 2015

No description provided.

@nrc
Copy link
Member Author

nrc commented Sep 2, 2015

Enabled rust-lang/rust#28161

}
}

pub fn overflow_context(&self, overflow: usize) -> RewriteContext<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a separation between regular block indentation and overflow indentation? Can't we simply set block_indent += config.tab_spaces?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention with block indent is that it tracks only that component of indentation, as opposed to the offset/indent which we pass around which is the current indent. It is useful to carry round the block indent in case we want to block indent some part of a sub-expression.

E.g.,

let foo = match {
    bar => {
        foo();
    }
    baz => qux,
};

let foo2 =
    bar2();

In the first case we ignore the overflow, in the second case we use it. If we saved the overflow into the block indent, then we could not ignore it and match expressions would be over-indented. (Note that this case is easier because the overflow is the block indent, but it might be a visual indent, in which case there is no way to recover the block indent).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough explanation. That makes sense.

marcusklaas added a commit that referenced this pull request Sep 2, 2015
Fix a bunch of misc. bugs I found
@marcusklaas marcusklaas merged commit 649be92 into master Sep 2, 2015
@marcusklaas marcusklaas deleted the bugs branch September 27, 2015 12:52
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

Successfully merging this pull request may close these issues.

2 participants