Patchwork D7812: examples: specify rustfmt nightly using a $() construct

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2020, 7:38 p.m.
Message ID <differential-rev-PHID-DREV-fn5vziu4ubmbtgueqmwd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44192/
State Superseded
Headers show

Comments

phabricator - Jan. 8, 2020, 7:38 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is ugly, but it's how we have to configure rustfmt for now as we
  require nightly rustfmt.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

AFFECTED FILES
  contrib/examples/fix.hgrc

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 8, 2020, 8:06 p.m.
gracinet added a comment.


  thanks for the tip. Fun fact: `rustup which` doesn't have a --toolchain option on my system, so perhaps it needs to be itself upgraded, (and that might explain a few things.
  I've been using rustmt nightly since forever, but maybe I'm stuck on an old version of it.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers
Cc: gracinet, mercurial-devel
phabricator - Jan. 9, 2020, 6:52 a.m.
quark added a comment.


  You can use `rustfmt +nightly` if it's installed by rustup.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers
Cc: quark, gracinet, mercurial-devel
phabricator - Jan. 10, 2020, 1:46 p.m.
gracinet added a comment.


  Ok, so yes I had an old version of rustfmt-nightly, dating back to the days it wasn't managed by rustup (crate `rustfmt-nightly`).
  Thanks for the heads up, guys.
  
  Now I'm pretty sure that `cargo +nightly fmt` just calls `rustup +nightly fmt`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers
Cc: quark, gracinet, mercurial-devel
phabricator - Jan. 13, 2020, 4:17 p.m.
pulkit added a comment.


  @gracinet Does this looks good to you?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers
Cc: pulkit, quark, gracinet, mercurial-devel
phabricator - Jan. 13, 2020, 7:57 p.m.
gracinet added a comment.


  @pulkit yes, after toolchain reinstall, this rustup which works for me

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers
Cc: pulkit, quark, gracinet, mercurial-devel
phabricator - Jan. 16, 2020, 4:38 p.m.
martinvonz added a comment.


  I was just going to note that it seems like this would not work on Windows, but then I saw Jun's comment which seems to suggest the same. I'll send a patch to switch to Jun's proposal.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7812/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7812

To: durin42, #hg-reviewers, pulkit
Cc: martinvonz, pulkit, quark, gracinet, mercurial-devel

Patch

diff --git a/contrib/examples/fix.hgrc b/contrib/examples/fix.hgrc
--- a/contrib/examples/fix.hgrc
+++ b/contrib/examples/fix.hgrc
@@ -2,7 +2,7 @@ 
 clang-format:command = clang-format --style file
 clang-format:pattern = set:(**.c or **.cc or **.h) and not "include:contrib/clang-format-ignorelist"
 
-rustfmt:command = rustfmt
+rustfmt:command = $(rustup which --toolchain nightly rustfmt)
 rustfmt:pattern = set:**.rs
 
 black:command = black --config=black.toml -