Skip to content

Refactoring: clean up source code #1983

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 7 commits into from
Sep 19, 2017
Merged

Refactoring: clean up source code #1983

merged 7 commits into from
Sep 19, 2017

Conversation

topecongiro
Copy link
Contributor

This PR consists of some refactoring.

  1. Move implementation of Shape and Spanned from lib.rs to dedicated files.
  2. Remove wrap_str()s and fix hidden bugs. wrap_str() makes sure that the given string fits the given width. However, it adds runtime overhead and obscure potential bugs.
  3. Use horizontal layout for a function call with a single argument which fits a single line. The rational is that in this case using vertical layout does not contribute to readabilty. e.g.:
// Do this
foo(this_is_a_long_argument_which_is_longer_than_fn_call_width);

// Instead of this
foo(
    this_is_a_long_argument_which_is_longer_than_fn_call_width,
);

Copy link
Member

@nrc nrc left a comment

Choose a reason for hiding this comment

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

This looks great, thanks! And I really appreciate having the PR broken into coherent commits, it makes reviewing much easier!

There is one minor change inline, r+ with that

@@ -201,8 +201,6 @@ where
let mut reports = vec![];

for file_name in files.filter(|f| f.ends_with(".rs")) {
println!("Testing '{}'...", file_name);
Copy link
Member

Choose a reason for hiding this comment

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

rather than removing, could we make this a debug!?

@topecongiro
Copy link
Contributor Author

This looks great, thanks! And I really appreciate having the PR broken into coherent commits, it makes reviewing much easier!

Thanks! I will keep that in mind.

Added debug!().

@nrc nrc merged commit c6b3cf9 into rust-lang:master Sep 19, 2017
@topecongiro topecongiro deleted the cleanup branch October 4, 2017 13:11
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