Commit Graph

67 Commits

Author SHA1 Message Date
Alexander Regueiro 7a3b7c9275 Various cosmetic improvements (#3403) 2019-02-19 11:56:42 +09:00
Evgenii ece629b1cc transition to Rust 2018 2019-02-04 13:30:43 +03:00
wada314 a01990c4d0 Use Unicode-standard char width to wrap comments or strings. (#3275) 2019-01-15 08:41:09 +09:00
wada314 09c9cd4125 Fix issue #3263 (#3264) 2018-12-25 18:03:48 +09:00
Philipp Hansch d0785954c8 Fix trim_right/trim_left deprecation warnings (#3252) 2018-12-18 11:21:31 +09:00
Matthias Krüger b25f974c0d fix a few typos found via codespell. 2018-10-19 12:28:00 +02:00
Nick Cameron c09d7ef088 Merge pull request #3106 from sinkuu/clippy
Clippy and cleanups
2018-10-16 09:09:56 +13:00
Nick Cameron bc4414e53c Merge pull request #3101 from nrc/pair-newline
Simplify multi-lining binop exprs
2018-10-16 09:01:40 +13:00
Shotaro Yamada 6fb188bd43 Use concat() instead of join("") 2018-10-15 23:59:08 +09:00
Shotaro Yamada 6380f88527 Cleanup 2018-10-15 23:59:08 +09:00
Daniele D'Orazio 075aa909cd try to fix comment bad wrapping (#3099) 2018-10-15 11:18:37 +09:00
Nick Cameron cbd568083d Fixup formatting 2018-10-15 11:52:27 +13:00
Stéphane Campinas 375c87820f rewrite_string: detect when a url is being split and place the new line
after it
2018-10-09 21:47:32 +02:00
Stéphane Campinas 8b3788d875 rewrite_string: allow to break on a boundary character that is on edge 2018-10-08 14:48:15 +02:00
Stéphane Campinas bb7442802a rewrite_string: retain blank lines that are trailing 2018-10-08 14:48:15 +02:00
Stéphane Campinas 1c6a2e3de8 rewrite_string: take care of blank lines appearing within the last line 2018-10-08 14:48:14 +02:00
Stéphane Campinas 3205e17cc3 rewrite_string: handle newlines in the last line that fits in the shape for cases where line_start is not a whitespace 2018-10-08 14:48:14 +02:00
Stéphane Campinas 2fc1de6b4a rewrite_string: do not overflow the next line when the line_start is not a whitespace 2018-10-08 14:48:13 +02:00
Stéphane Campinas f46082fbd8 rewrite_string: trim trailing whitespace in case the last_line fits in the given shape 2018-10-08 14:48:13 +02:00
Stéphane Campinas 4b26723e55 format_strings: take into account newline occurring within a rewritten line 2018-10-02 00:41:56 +02:00
Stéphane Campinas 86018133a0 removed unused max_width argument of rewrite_string function 2018-07-14 19:33:26 +02:00
Stéphane Campinas 472a2ed0f6 fix rewrite_string when a line feed is present in a sequence of whitespaces, resulting in strange formatting 2018-07-14 19:22:31 +02:00
Nick Cameron 486f8fd8e7 Fixup formatting of tests and source 2018-07-12 21:37:28 +12:00
Pazzaz f711078126 Seperate and optimize grapheme conditions 2018-05-24 21:32:01 +02:00
Pazzaz a1d137116b Avoid unnecessary comparisons with cur_end 2018-05-24 21:32:01 +02:00
Nick Cameron 39301ae5f2 Go back to a non-workspace structure
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro 4af2aa3a9e Create rustfmt_core crate 2018-02-07 22:48:05 +09:00
Seiichi Uchida 154bf8e1af Cargo fmt 2018-01-22 13:05:18 +09:00
topecongiro bc31014423 Add an optional max width argument to rewrite_string() 2017-10-31 15:04:50 +09:00
topecongiro 7e99893e25 Use visual indent only when rewriting string literal 2017-10-31 15:03:46 +09:00
topecongiro 0d359eacd7 Cargo fmt 2017-10-18 22:23:25 +09:00
topecongiro fe69dde96b Replace 'try_opt!' macro with a '?' operator 2017-10-05 20:50:19 +09:00
topecongiro b74a0f960a Implement StringFormat::new() 2017-10-01 19:39:00 +09:00
Seiichi Uchida df7d2be562 Move Indent and Shape to shape.rs from lib.rs 2017-09-19 10:04:35 +09:00
topecongiro f51261e93e Cargo fmt 2017-09-15 12:10:58 +09:00
Seiichi Uchida a8b0a6e4c5 Format source codes and update tests 2017-07-20 00:42:00 +09:00
topecongiro 6fd291981e Sort imports in alphabetical and consistent order 2017-07-13 18:42:14 +09:00
topecongiro 208ff15954 Format source codes 2017-06-16 08:49:49 +09:00
topecongiro b8f11a4e3c Format source codes 2017-06-14 20:39:07 +09:00
Nick Cameron 18ccd0190e Rebasing 2017-06-13 14:49:47 +12:00
Nick Cameron 1f512948a0 Reformat source code using new defaults 2017-06-13 14:41:49 +12:00
topecongiro 86856491bc Format source codes 2017-05-25 16:08:08 +09:00
topecongiro 04bb5d8929 Format source codes 2017-05-24 00:07:02 +09:00
Michael Killough c0bdbfa531 Switch to accessing config items via method.
Preparation for #865, which proposes adding a flag which outputs which
config options are used during formatting.

This PR should not make any difference to functionality. A lot of this
was search-and-replace.

Some areas worthy of review/discussion:

 - The method for each config item returns a clone of the underlying
   value. We can't simply return an immutable reference, as lots of
   places in the code expect to be able to pass the returned value as
   `bool` (not `&bool). It would be nice if the `bool` items could
   return a copy, but the more complex types a borrowed reference... but
   unfortunately, I couldn't get the macro to do this.
 - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
   config items by modifying the fields of the `Config` struct directly.
   They now use the existing `override_value()` method, which has been
   modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
   benefits of this are that the complex `file_lines` and `write_mode`
   strings are now parsed in one place (`Config.override_value`) instead
   of multiple. The disadvantages are that it moves the compile-time
   checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
topecongiro f5da9d779f Format source codes 2017-05-03 11:26:25 +09:00
Nick Cameron 5fb1140688 fallout - source reformatting 2017-03-28 11:14:47 +13:00
Nick Cameron e4efa22983 Source formatting fallout 2017-03-28 10:58:41 +13:00
Igor Gnatenko 3323056893 bump regex to 0.2
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-02-26 15:09:31 +01:00
Nick Cameron 9eb78a3333 Fallout 2017-02-23 13:15:48 +13:00
Nick Cameron b35906dbce WIP 2017-02-21 16:35:05 +13:00