Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Format-on-save inconsistent with using rustfmt directly #210

Closed
str4d opened this issue Dec 9, 2017 · 3 comments
Closed

Format-on-save inconsistent with using rustfmt directly #210

str4d opened this issue Dec 9, 2017 · 3 comments

Comments

@str4d
Copy link

str4d commented Dec 9, 2017

I have a large constant in one of my files (constants.rs, funnily enough). If I use rustfmt directly on the file from the CLI, the constant is wrapped quite nicely. If I use editor.formatOnSave with the rls-vscode plugin, it is... not:

diff --git a/src/constants.rs b/src/constants.rs
index 09b4a0e..c929668 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -23,35 +23,264 @@ impl CryptoConstants {
     pub fn new() -> Self {
         CryptoConstants {
             elg_g: BigUint::parse_bytes(b"2", 10).unwrap(),
-            elg_p: BigUint::from_bytes_be(&[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9,
-                                            0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6,
-                                            0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1, 0x29, 0x02, 0x4e,
-                                            0x08, 0x8a, 0x67, 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6,
-                                            0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e,
-                                            0x34, 0x04, 0xdd, 0xef, 0x95, 0x19, 0xb3, 0xcd, 0x3a,
-                                            0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d, 0xf2, 0x5f, 0x14,
-                                            0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, 0xc2, 0x45,
-                                            0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, 0xf4,
-                                            0x4c, 0x42, 0xe9, 0xa6, 0x37, 0xed, 0x6b, 0x0b, 0xff,
-                                            0x5c, 0xb6, 0xf4, 0x06, 0xb7, 0xed, 0xee, 0x38, 0x6b,
-                                            0xfb, 0x5a, 0x89, 0x9f, 0xa5, 0xae, 0x9f, 0x24, 0x11,
-                                            0x7c, 0x4b, 0x1f, 0xe6, 0x49, 0x28, 0x66, 0x51, 0xec,
-                                            0xe4, 0x5b, 0x3d, 0xc2, 0x00, 0x7c, 0xb8, 0xa1, 0x63,
-                                            0xbf, 0x05, 0x98, 0xda, 0x48, 0x36, 0x1c, 0x55, 0xd3,
-                                            0x9a, 0x69, 0x16, 0x3f, 0xa8, 0xfd, 0x24, 0xcf, 0x5f,
-                                            0x83, 0x65, 0x5d, 0x23, 0xdc, 0xa3, 0xad, 0x96, 0x1c,
-                                            0x62, 0xf3, 0x56, 0x20, 0x85, 0x52, 0xbb, 0x9e, 0xd5,
-                                            0x29, 0x07, 0x70, 0x96, 0x96, 0x6d, 0x67, 0x0c, 0x35,
-                                            0x4e, 0x4a, 0xbc, 0x98, 0x04, 0xf1, 0x74, 0x6c, 0x08,
-                                            0xca, 0x18, 0x21, 0x7c, 0x32, 0x90, 0x5e, 0x46, 0x2e,
-                                            0x36, 0xce, 0x3b, 0xe3, 0x9e, 0x77, 0x2c, 0x18, 0x0e,
-                                            0x86, 0x03, 0x9b, 0x27, 0x83, 0xa2, 0xec, 0x07, 0xa2,
-                                            0x8f, 0xb5, 0xc5, 0x5d, 0xf0, 0x6f, 0x4c, 0x52, 0xc9,
-                                            0xde, 0x2b, 0xcb, 0xf6, 0x95, 0x58, 0x17, 0x18, 0x39,
-                                            0x95, 0x49, 0x7c, 0xea, 0x95, 0x6a, 0xe5, 0x15, 0xd2,
-                                            0x26, 0x18, 0x98, 0xfa, 0x05, 0x10, 0x15, 0x72, 0x8e,
-                                            0x5a, 0x8a, 0xac, 0xaa, 0x68, 0xff, 0xff, 0xff, 0xff,
-                                            0xff, 0xff, 0xff, 0xff]),
+            elg_p: BigUint::from_bytes_be(&[
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xc9,
+                0x0f,
+                0xda,
+                0xa2,
+                0x21,
+                0x68,
+                0xc2,
+                0x34,
+                0xc4,
+                0xc6,
+                0x62,
+                0x8b,
+                0x80,
+                0xdc,
+                0x1c,
+                0xd1,
+                0x29,
+                0x02,
+                0x4e,
+                0x08,
+                0x8a,
+                0x67,
+                0xcc,
+                0x74,
+                0x02,
+                0x0b,
+                0xbe,
+                0xa6,
+                0x3b,
+                0x13,
+                0x9b,
+                0x22,
+                0x51,
+                0x4a,
+                0x08,
+                0x79,
+                0x8e,
+                0x34,
+                0x04,
+                0xdd,
+                0xef,
+                0x95,
+                0x19,
+                0xb3,
+                0xcd,
+                0x3a,
+                0x43,
+                0x1b,
+                0x30,
+                0x2b,
+                0x0a,
+                0x6d,
+                0xf2,
+                0x5f,
+                0x14,
+                0x37,
+                0x4f,
+                0xe1,
+                0x35,
+                0x6d,
+                0x6d,
+                0x51,
+                0xc2,
+                0x45,
+                0xe4,
+                0x85,
+                0xb5,
+                0x76,
+                0x62,
+                0x5e,
+                0x7e,
+                0xc6,
+                0xf4,
+                0x4c,
+                0x42,
+                0xe9,
+                0xa6,
+                0x37,
+                0xed,
+                0x6b,
+                0x0b,
+                0xff,
+                0x5c,
+                0xb6,
+                0xf4,
+                0x06,
+                0xb7,
+                0xed,
+                0xee,
+                0x38,
+                0x6b,
+                0xfb,
+                0x5a,
+                0x89,
+                0x9f,
+                0xa5,
+                0xae,
+                0x9f,
+                0x24,
+                0x11,
+                0x7c,
+                0x4b,
+                0x1f,
+                0xe6,
+                0x49,
+                0x28,
+                0x66,
+                0x51,
+                0xec,
+                0xe4,
+                0x5b,
+                0x3d,
+                0xc2,
+                0x00,
+                0x7c,
+                0xb8,
+                0xa1,
+                0x63,
+                0xbf,
+                0x05,
+                0x98,
+                0xda,
+                0x48,
+                0x36,
+                0x1c,
+                0x55,
+                0xd3,
+                0x9a,
+                0x69,
+                0x16,
+                0x3f,
+                0xa8,
+                0xfd,
+                0x24,
+                0xcf,
+                0x5f,
+                0x83,
+                0x65,
+                0x5d,
+                0x23,
+                0xdc,
+                0xa3,
+                0xad,
+                0x96,
+                0x1c,
+                0x62,
+                0xf3,
+                0x56,
+                0x20,
+                0x85,
+                0x52,
+                0xbb,
+                0x9e,
+                0xd5,
+                0x29,
+                0x07,
+                0x70,
+                0x96,
+                0x96,
+                0x6d,
+                0x67,
+                0x0c,
+                0x35,
+                0x4e,
+                0x4a,
+                0xbc,
+                0x98,
+                0x04,
+                0xf1,
+                0x74,
+                0x6c,
+                0x08,
+                0xca,
+                0x18,
+                0x21,
+                0x7c,
+                0x32,
+                0x90,
+                0x5e,
+                0x46,
+                0x2e,
+                0x36,
+                0xce,
+                0x3b,
+                0xe3,
+                0x9e,
+                0x77,
+                0x2c,
+                0x18,
+                0x0e,
+                0x86,
+                0x03,
+                0x9b,
+                0x27,
+                0x83,
+                0xa2,
+                0xec,
+                0x07,
+                0xa2,
+                0x8f,
+                0xb5,
+                0xc5,
+                0x5d,
+                0xf0,
+                0x6f,
+                0x4c,
+                0x52,
+                0xc9,
+                0xde,
+                0x2b,
+                0xcb,
+                0xf6,
+                0x95,
+                0x58,
+                0x17,
+                0x18,
+                0x39,
+                0x95,
+                0x49,
+                0x7c,
+                0xea,
+                0x95,
+                0x6a,
+                0xe5,
+                0x15,
+                0xd2,
+                0x26,
+                0x18,
+                0x98,
+                0xfa,
+                0x05,
+                0x10,
+                0x15,
+                0x72,
+                0x8e,
+                0x5a,
+                0x8a,
+                0xac,
+                0xaa,
+                0x68,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+                0xff,
+            ]),
         }
     }
 }
$ rustup show
Default host: x86_64-unknown-linux-gnu

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2017-11-10-x86_64-unknown-linux-gnu
nightly-2017-12-01-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.22.1 (05e2e1c41 2017-11-22)

$ rustfmt --version
0.8.0 ()
$ rls --version
rls-preview 0.122.0-stable (93b47d1 2017-09-25)
@str4d
Copy link
Author

str4d commented Dec 9, 2017

Changed my VSCode Rust channel from stable to nightly-2017-12-01 and tried again; same issue.

$ rustup run nightly-2017-12-01 rls --version
rls-preview 0.124.0-nightly (194f828 2017-11-27)

@jonasbb
Copy link
Contributor

jonasbb commented Dec 10, 2017

Could you check with rustfmt-nightly instead of rustfmt? See this other discussion thread: #132

@nrc
Copy link
Member

nrc commented Dec 10, 2017

$ rustfmt --version
0.8.0 ()

This is a very old version of rustfmt, you should use rustfmt-nightly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants