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

Add failure mode to write_list #251

Merged
merged 2 commits into from
Sep 7, 2015
Merged

Add failure mode to write_list #251

merged 2 commits into from
Sep 7, 2015

Conversation

marcusklaas
Copy link
Contributor

Fixes some cases where we would exceed the column limit.

mem_profiler_chan,
devtools_chan,
storage_task,
supports_clipboard);
Copy link
Member

Choose a reason for hiding this comment

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

nice :-)

@nrc
Copy link
Member

nrc commented Sep 6, 2015

looks good! Other than the inline comments, there are a couple of FIXMEs on magic 100s. I think you should fix them now, since I don't think they will get any easier in the future and are the kind of thing that will sit around without a fix for a long time, but cause some subtle bug when someone actually tries running with a non-100 max width. r+ with those fixed.

_ if tries > 10 => return None,
Ok(result) => return Some(result),
Err(Ordering::Less) => {
lo = middle;
Copy link
Contributor

Choose a reason for hiding this comment

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

This may be way off, but should it be lo = middle + 1 to avoid infinite loop in case hi = lo + 1? Same for hi = middle - 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right! I guess this proves @nrc's point about binary search being prone to off-by-one errors ;-)

marcusklaas added a commit that referenced this pull request Sep 7, 2015
Add failure mode to `write_list`
@marcusklaas marcusklaas merged commit 156263a into rust-lang:master Sep 7, 2015
@marcusklaas marcusklaas deleted the rewrite-list branch September 7, 2015 20:23
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.

3 participants