profile
viewpoint
David Tolnay dtolnay 0xF9BA143B95FF6D82 Redwood City, California, USA

dtolnay/cxx 4786

Safe interop between Rust and C++

dtolnay/anyhow 4100

Flexible concrete Error type built on std::error::Error

dtolnay/cargo-expand 2023

Subcommand to show result of macro expansion

brson/stdx 1906

The missing batteries of Rust

dtolnay/async-trait 1471

Type erasure for async trait methods

dtolnay/case-studies 1326

Analysis of various tricky Rust code

chyh1990/yaml-rust 562

A pure rust YAML implementation.

dtolnay/dyn-clone 478

Clone trait that is object-safe

dtolnay/erased-serde 452

Type-erased Serialize, Serializer and Deserializer traits

dtolnay/cargo-llvm-lines 323

Count lines of LLVM IR per generic function

issue closeddtolnay/quote

`quote!` and `quote_spanned!` macro should take `&mut TokenStream`

<!-- ❤️ --> Hey! dtolnay, Thanks for your great work! ❤️

I think quote! and quote_spanned! macro should take &mut TokenStream instead of creating new one.

Instead of this:

let import = items.iter().map(|item| quote_spanned!(item.span()=> use #item));
quote! { 
    #(#import)* 
    // ...
}

I think it should look something like this:

// `to_tokens_fn` accept closure and return a struct that implement `ToTokens`

let import = to_tokens_fn(|tokens| { 
    for item in items {
        quote_spanned!(tokens, item.span()=> use #item);
    }
});

impl ToTokens for <Struct> {
    fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
        quote!(tokens, { 
            #import
            // ...
        })
    }
}

This approach should be more performance, Because it avoid cloning.

Sorry if this is duplicate.

closed time in 2 hours

arafatrahman862

issue commentdtolnay/quote

`quote!` and `quote_spanned!` macro should take `&mut TokenStream`

I would prefer not to support this in this crate.

arafatrahman862

comment created time in 2 hours

create barnchdtolnay-contrib/reindeer

branch : git

created branch time in 20 hours

delete branch dtolnay-contrib/reindeer

delete branch : master

delete time in 20 hours

issue openedfacebookincubator/reindeer

Crates in lockfile are incompatible with current nightly Rust

The readme's recommended installation instruction of cargo install --locked --git https://github.com/facebookincubator/reindeer fails on nightly:

error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
  --> value-bag-1.0.0-alpha.9/src/internal/cast/primitive.rs:43:33
   |
43 |   ...                           $const_ident => |v| Some(Internal::from(unsafe { &*(*...
   |                                 ^^^^^^^^^^^^
...
71 | / ...   to_internal![
72 | | ...       usize: (USIZE, OPTION_USIZE),
73 | | ...       u8: (U8, OPTION_U8),
74 | | ...       u16: (U16, OPTION_U16),
...  |
96 | | ...       String: (STRING, OPTION_STRING),
97 | | ...   ];
   | |_______- in this macro invocation
   |
   = note: the traits must be derived, manual `impl`s are not sufficient
   = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
   = note: this error originates in the macro `to_internal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
  --> value-bag-1.0.0-alpha.9/src/internal/cast/primitive.rs:46:33
   |
46 |                                   $option_ident => |v| Some({
   |                                   ^^^^^^^^^^^^^
...
71 | /         to_internal![
72 | |             usize: (USIZE, OPTION_USIZE),
73 | |             u8: (U8, OPTION_U8),
74 | |             u16: (U16, OPTION_U16),
...  |
96 | |             String: (STRING, OPTION_STRING),
97 | |         ];
   | |_________- in this macro invocation
   |
   = note: the traits must be derived, manual `impl`s are not sufficient
   = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
   = note: this error originates in the macro `to_internal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: to use a constant of type `TypeId` in a pattern, `TypeId` must be annotated with `#[derive(PartialEq, Eq)]`
  --> value-bag-1.0.0-alpha.9/src/internal/cast/primitive.rs:55:29
   |
55 |   ...                       STR => |v| Some(Internal::from(unsafe { &**(v as *const &...
   |                             ^^^
...
71 | / ...   to_internal![
72 | | ...       usize: (USIZE, OPTION_USIZE),
73 | | ...       u8: (U8, OPTION_U8),
74 | | ...       u16: (U16, OPTION_U16),
...  |
96 | | ...       String: (STRING, OPTION_STRING),
97 | | ...   ];
   | |_______- in this macro invocation
   |
   = note: the traits must be derived, manual `impl`s are not sufficient
   = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
   = note: this error originates in the macro `to_internal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `value-bag` (lib) due to 3 previous errors

Without --locked, it installs successfully using a newer version of value-bag.

created time in 21 hours

create barnchdtolnay-contrib/cxx

branch : serde

created branch time in a day

push eventdtolnay-contrib/buck2-prelude

Michael Shtutman

commit sha 3e4d218ced25406bf51041a685fe30d870f88dca

Fix maven urls Summary: buck2 is not able to handle some of `mvn:XXX` target types. Buck2 migration is mandatory and due by June. We're buckifying an old legacy maven service D46071993 which is to be deprecated soon and went for using maven artifacts in buck until we delete the whole service by the EOY. ``` * fbcode/buck2/prelude/remote_file.bzl:50, in <module> url = _from_mvn_url(url) * fbcode/buck2/prelude/remote_file.bzl:27, in _from_mvn_url fail("Unsupported mvn URL scheme: " + url + " (" + str(count) + ")") error: fail: Unsupported mvn URL scheme: mvn:io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.58.Final (5) --> fbcode/buck2/prelude/remote_file.bzl:27:9 | 27 | fail("Unsupported mvn URL scheme: " + url + " (" + str(count) + ")") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ``` Reviewed By: andrewjcg Differential Revision: D45992990 fbshipit-source-id: 0542f77255f1cd155b37f50a41f18d027e9af9e3

view details

Andrew Gallagher

commit sha 16830aadfd37df0579942bb3d6f01a95348907a1

Restore internal link mode Summary: The fbcode toolchains were moved to external linking to support `go_exported_library`. However, this causes some breakages in cases that don't expect it. S343944 Reviewed By: mzlee, addumb Differential Revision: D46200741 fbshipit-source-id: 2089983cc9d39c548728f27ac80b81ddef84a5a0

view details

Andrew Gallagher

commit sha 20b7b591ea32ec6b1208b6f49f6c8c8b4dd1e965

Support building native python w/ PIE (take 2) Summary: For some reason, linking an executable with PIE avoids some classes of relocation overflows and is one of the remaining differences in the size of the native python executable and omnibus link. This diff exposes a new `native_python_pie` parameter to allow linking the native executable as a PIE. Second attempt avoids implicitly enabling PIE for TSAN, as reported at https://www.internalfb.com/diff/D46012365?dst_version_fbid=791246552322858&transaction_fbid=1293842538214143. Reviewed By: itamaro Differential Revision: D46266248 fbshipit-source-id: f51c090fb3b02ef0342cc1c3f2f4111af8c30e44

view details

Jakob Degen

commit sha f0da687b90aa748ce8b89ba0a1ecb930ddfd5c3e

Run locally until Pika toolchain issue is fixed Summary: D46157641 broke `rust_universal_binary` on RE. D46227259 will fix it, however that diff seems to be having some trouble getting through CI. To unbreak builds in the meantime, force these to run locally. I'll ask the author of D46227259 to revert this diff as a part of their change, to ensure that this doesn't re-break and they get CI coverage Reviewed By: zertosh Differential Revision: D46296798 fbshipit-source-id: d3e4846c5553c59d03a6d7a64fffde9cea7f2b48

view details

Chris Tolliday

commit sha da7772cf77d47fc9bb4d1a7815491b337424bf27

Use javacd_worker/kotlincd_worker in buck2 prelude Summary: Add worker tools to java/kotlin toolchains and configure them for javacd/kotlincd actions, when not passing debug args. Currently disabled but can be tested with `-c build.use_persistent_workers=True` (falls back to `exe` arg in `WorkerRunInfo`) Reviewed By: navidqar Differential Revision: D45648186 fbshipit-source-id: 2ffbb5ce1d2e8c4968b46abd78725c9f906a5f32

view details

Chris Tolliday

commit sha 287ba157bf07326659e903ffa1b57df3a296adb0

Use worker rule for javacd and kotlincd Summary: Calling `WorkerInfo` within `prepare_cd_exe` effectively creates a new worker for each action, having it be specified by a shared rule ensures that the worker itself is shared since the identity of the worker is essentially the starlark pointer value of the `WorkerInfo`. This way in a given build there should be a single javacd worker and a single kotlincd worker. Reviewed By: IanChilds Differential Revision: D46222807 fbshipit-source-id: f8d2628671bf1ba9b9fb544899a59e4ef00532be

view details

Rick Mark

commit sha efc3cc61ecc0da6cc0af8ed079f65f07b2710ef9

Sub-target for cxx_library to produce bitcode bundles (merged .bc file) Summary: This is a change to `cxx_library` whereby a subtarget of ["bitcode"] exists for libraries. This is just the object files for the library at hand, and only for static. Shared will be supported as well, but will have the concept of both direct objects, as well as the sum of objects plus static library bundles. Differential Revision: D45632239 fbshipit-source-id: 295a0b39eb7370d422d0cd1df8c4440cba8bc06e

view details

Andrew Gallagher

commit sha 51eca37f7d950a72150078c19a1a393f54db2466

Add `write_file` builtin Summary: This adds a `write_file` builtin m Reviewed By: mzlee Differential Revision: D46305268 fbshipit-source-id: 23b903132bf65085b69a73296774fc11679af160

view details

Andrew Gallagher

commit sha ca1f5abf191b80798fa53d83508186077f8e7444

Don't fail when special shell chars are in rule name Summary: Previously, `genrule`s would die of they had a special shell char in the rule name. Reviewed By: IanChilds Differential Revision: D46212658 fbshipit-source-id: b6cfd2e41b1eb482fc6110ebf8129be74b32ff63

view details

Chatura Atapattu

commit sha faaff7b6d07a007f4ca0b3f9205760db9f6e6c28

Dedupe CxxCompileCommandOutputForCompDb into CxxCompileCommandOutput Summary: In D37477974, `CxxCompileCommandOutputForCompDb` was introduced to allow setting compile commands that were for the compilation db only: https://www.internalfb.com/code/fbsource/[455092982907ae1fbd7d1e2ca8117edb6ff7dae9]/fbcode/buck2/prelude/cxx/compile.bzl?lines=128-134 This is so that for header only libraries, we can add them to the comp db: https://www.internalfb.com/code/fbsource/[455092982907ae1fbd7d1e2ca8117edb6ff7dae9]/fbcode/buck2/prelude/cxx/compile.bzl?lines=275-284 We don't need to include two `CxxCompileCommandOutput` in order to achieve this. We can simply add a another field that is for compilation db only and then dedupe/delete the `CxxCompileCommandOutputForCompDb` record. This simplifies the code and makes it easier to add additional arguments to `CxxCompileCommandOutput` without unnecessarily duping additional code. Lastly, added meaningful defaults to `CxxCompileCommandOutput` to make it easier to create with less fields. Differential Revision: D46325905 fbshipit-source-id: 39b44bc066ed15fcac04b5de25072c5287774888

view details

Jakob Degen

commit sha 3cebd5532c6d4e60e29f881a406dae1284064534

Remove unused genrule local label Summary: No longer needed after D46319111 Reviewed By: zertosh Differential Revision: D46334871 fbshipit-source-id: e5352373620e8f6df9dd0e1e7734524c7df243a7

view details

Gustavo Galvao Avena

commit sha f65d0eac07807de1c3307557ef3fc2c40e7cc81e

Properly handle export_file targets in haskell rules Summary: ## Problem The `LoadCache.hs` module on the `//haxl/core/tests:haxl-core-unit-lib` rule depends on a text file, `LoadCache.txt`. The text file is "exposed" via an `expose_file` rule that works in buck1, but not in buck2. ## Why? FWIU, the `LoadCache.hs` haskell module depends on `LoadCache.txt` **as a source file**. The `export_file` rule will make the file available as a resource, i.e. in the `buck-out` directory, which wasn't enough in this case. ## Proposed solution Create a new provider for `export_file` which lets dependant rules know when a dependency is one that type and handle the exported file accordingly. In the case of `LoadCache.hs`, we'll add it as a hidden dependency to the compilation step. Reviewed By: pepeiborra Differential Revision: D46274259 fbshipit-source-id: 94a9d7a36adf3c4e72c71841283ea792e5fc43cf

view details

Fabian Mastenbroek

commit sha 3ea32c3c713aae9953f37080c8177ca49bce8941

Propagate linker flags in go_test Summary: Update the `go_test` rule to propagate the linker flags to the Go linker. Linker flags are accepted by `go_test` but not passed to the linker at the moment. Reviewed By: andrewjcg Differential Revision: D46316495 fbshipit-source-id: 0b540ddeb1ae8d58bc27d6eb4bf8fef5a9943a12

view details

Daniel Gorin

commit sha 5a3da6c758837459279bfc5c8e4c7ee3feccf267

Extend custom error formatting protocol to property maps Summary: We extend the protocol for custom formatting of errors, so that the error properties where the formatter is specified can be not only a proplist, but also a map. Maps are more convenient for writing properties; can be given precise types in specs; and the formatter function already expects the properties to be a map! Reviewed By: Balajiganapathi Differential Revision: D46336315 fbshipit-source-id: 08cce96e95d7c307404a1a20d94bce68d751433f

view details

Xiaotian Wu

commit sha c5915006d2be8771b92df2c537e307d209b4198f

support list of string in metadata Summary: To give a better user experience, we let the user assign a list of string to metadata as the value more discussion is in the diff D46222369 Reviewed By: TheGeorge Differential Revision: D46280037 fbshipit-source-id: 988e03fb5203bd5adef1487f49791e03c664f936

view details

Sean Vong-Karlage

commit sha 4e0f0c1a9c73e8851267588f32d67dc5b887eb8e

Add support for specifying vpnless_url Reviewed By: JakobDegen Differential Revision: D45856314 fbshipit-source-id: f012307b3d04d99eb54894bd2286d627ad1e4b97

view details

Andrew Gallagher

commit sha 0f051378fd3045061b168922c87f6d8d790ac558

Fix `auto` mode Summary: Fix bug in using the `auto` mode for `write_file` newlines. Reviewed By: mzlee Differential Revision: D46325248 fbshipit-source-id: ab9d565912683eef201cd685272f4e064af3ae3d

view details

Ian Childs

commit sha 48edd04e86ba4192b180d3ea6d377493ce5e445e

exo-for-resources should still package resources from third-party jars into the main APK Summary: `buck1` (incorrectly, I assume, but seems like there are places that depend upon this behavior) still packages resources from third-party jars into the main APK when exo-for-resources is enabled. This makes it so that `buck2` does the same thing. Reviewed By: navidqar Differential Revision: D46351462 fbshipit-source-id: 309f1c62c7e2ca521409c53a9cce6bccb7b6e407

view details

Alexey Kozhevnikov

commit sha cde797161c9284affd719ef48806daa2681952ba

add type argument to resource broker Summary: I'll be adding support for macOS in next diff, in the meanwhile add support for type parameter Reviewed By: Nekitosss Differential Revision: D46326780 fbshipit-source-id: 842e7dbe840dd93ad2304baf827a1cd25b90b147

view details

Alexey Kozhevnikov

commit sha de444e3bf7c2214095cde19e25f4a62451da65f0

add rules support for macos_idb_companion local resource type Summary: ditto Reviewed By: Nekitosss Differential Revision: D46326783 fbshipit-source-id: 8421f038f57dd6bd2d2bd80702238f856f793a1f

view details

push time in a day

delete branch dtolnay/syn

delete branch : threadboundclone

delete time in a day

push eventdtolnay/syn

David Tolnay

commit sha 250a08d5a1f1816eecec1a9e1709db6ab09e16d2

Fix call of proc_macro::Span::clone on the wrong thread

view details

David Tolnay

commit sha 2a001f4ba32eccda0063c4426cab84abbd4d11aa

Merge pull request #1466 from dtolnay/threadboundclone Fix call of proc_macro::Span::clone on the wrong thread

view details

push time in a day

PR merged dtolnay/syn

Fix call of proc_macro::Span::clone on the wrong thread

The way #1315 was implemented is unsound if someone has a standard library implementation on which proc_macro::Span's Clone impl is not just equivalent to its Copy impl, but involves accessing the span's thread-local data.

Reported by @joshlf.

+16 -6

0 comment

2 changed files

dtolnay

pr closed time in a day

PR opened dtolnay/syn

Fix call of proc_macro::Span::clone on the wrong thread

The way #1315 was implemented is unsound if someone has a standard library implementation on which proc_macro::Span's Clone impl is not just equivalent to its Copy impl, but involves accessing the span's thread-local data.

Reported by @joshlf.

+16 -6

0 comment

2 changed files

pr created time in a day

create barnchdtolnay/syn

branch : threadboundclone

created branch time in a day

issue closeddtolnay/syn

Group spans don't round-trip when run under rust-analyzer

I'd expect that a proc macro that does nothing but parse its input and convert it back to a token stream will be a no-op:

#[proc_macro_attribute]
pub fn foo(_args: TokenStream, input: TokenStream) -> TokenStream {
    dbg!(&input);
    let parsed_input = parse_macro_input!(input as ItemFn);
    dbg!(parsed_input.to_token_stream().into())
}

When I use this proc macro in some crate, and compile it with cargo check, it does indeed seem to round trip correctly. But when I run it with rust-analyzer diagnostics ., it does not: everything is identical between input and output except for the spans of Groups. For example, where the input has

    Group {
        delimiter: Parenthesis,
        stream: TokenStream [],
        span: 2,
    }

the output will have

   Group {
        delimiter: Parenthesis,
        stream: TokenStream [],
        span: 4294967295,
    }

I have a full example set up here

closed time in 3 days

jneem

issue commentdtolnay/syn

Group spans don't round-trip when run under rust-analyzer

If this behaves correctly using rustc's proc macro server, and behaves incorrectly using rust-analyzer's proc macro server, then this is a rust-analyzer bug.

jneem

comment created time in 3 days

push eventdtolnay/anyhow

David Tolnay

commit sha 1f17666ef1d4d3cd1f05a9ee5e79f75d66801c66

Ignore needless_else clippy lint in test suite error: this else branch is empty --> tests/test_ensure.rs:177:42 | 177 | let test = || Ok(ensure!(if false {} else {}.t(1) == 2)); | ^^^^^^^ help: you can remove it | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_else = note: `-D clippy::needless-else` implied by `-D clippy::all`

view details

push time in 3 days

push eventdtolnay/proc-macro2

David Tolnay

commit sha 528e7610eb1e3a1b4f829897f6ab019c8c88d7db

Ignore missing_fields_in_debug clippy lint for Ident error: manual `Debug` impl does not include all fields --> src/fallback.rs:853:1 | 853 | / impl Debug for Ident { 854 | | // Ident(proc_macro), Ident(r#union) 855 | | #[cfg(not(span_locations))] 856 | | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ... | 872 | | } 873 | | } | |_^ | note: this field is unused --> src/fallback.rs:748:5 | 748 | raw: bool, | ^^^^^^^^^ = help: consider including all fields in this `Debug` impl = help: consider calling `.finish_non_exhaustive()` if you intend to ignore fields = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_fields_in_debug = note: `-D clippy::missing-fields-in-debug` implied by `-D clippy::pedantic`

view details

push time in 3 days

issue commenttamasfe/taplo

`--stdin-filepath` should affect application of rules

The behavior is the same even with #378. Tested with:

$ cargo run \
    --manifest-path /tmp/taplo/crates/taplo-cli/Cargo.toml \
    --bin taplo \
    -- \
    format --config ./taplo.toml path/to/thing.toml
$ cargo run \
    --manifest-path /tmp/taplo/crates/taplo-cli/Cargo.toml \
    --bin taplo \
    -- \
    format --config ./taplo.toml --stdin-filepath path/to/thing.toml - <path/to/thing.toml
dtolnay

comment created time in 3 days

issue commenttamasfe/taplo

`format --diff` still overwrites file

As a workaround I found taplo format --check --diff thing.toml.

I think not overwriting files would be the better behavior for --diff, even without --check.

That said, I am not clear what the intended use of --diff is. A hypothetical usage I was able to think of is:

# .github/workflows/ci.yml

...
  steps:
     ...
    - run: cargo test
    - name: "check that source files are properly formatted"
      run: cargo fmt -- --check
      if: always()
    - name: "the toml files too"
      run: taplo format --diff && git diff --exit-code >/dev/null
      if: always()

Here, what the user wants (from both rustfmt and taplo) is:

  1. If any files in the repo are incorrectly formatted, fail CI on the commit.

  2. Show the lines that need to be reformatted, not just the filenames. This would be important if the user was not able to, or did not want to, install rustfmt/taplo on their machine when writing their contribution to someone else's repo, or had a different rustfmt/taplo version installed than required by CI. They can manually apply the required formatting.

But for this objective, taplo format --diff is not any better than taplo format && git diff --exit-code.

Are there any foreseen use cases for taplo format --diff without --check? If not, perhaps --diff should imply --check. Separately, perhaps --check should imply --diff, like in rustfmt? At that point it would be okay to remove --diff altogether.

dtolnay

comment created time in 3 days

issue openedtamasfe/taplo

`format --diff` still overwrites file

I have the following TOML file:

# thing.toml

space = "none"

Running taplo format --diff thing.toml produces the following output on stdout, as expected (modulo #415):

diff a//git/repro/taplo/thing.toml b//git/repro/taplo/thing.toml
--- a//git/repro/taplo/thing.toml
+++ b//git/repro/taplo/thing.toml
# thing.toml

@@ -0,2 +0,2 @@
@@ -2,1 +2,1 @@
-space="none"
+space = "none"

However, it also overwrites thing.toml with the resulting formatted toml. This is unexpected. Other tools' equivalent option for diff generation only prints the diff, leaving the original file in place.

For example rustfmt:

$ cat repro.rs
// repro.rs

fn main ( ) { }
$ rustfmt --check repro.rs
Diff in /git/repro/taplo/repro.rs at line 1:
 // repro.rs
 
-fn main ( ) { }
+fn main() {}
 
$ cat repro.rs
// repro.rs

fn main ( ) { }

created time in 3 days

issue openedtamasfe/taplo

`--diff` produces non-deterministic/nonsensical diffs

I have the following TOML file:

# thing.toml

space="none"

Running taplo format --diff thing.toml 2>/dev/null produces a variety of different possible outputs on stdout. Among them:

diff a//git/repro/taplo/thing.toml b//git/repro/taplo/thing.toml
--- a//git/repro/taplo/thing.toml
+++ b//git/repro/taplo/thing.toml
@@ -0,2 +0,2 @@
# thing.toml

-space="none"
+space = "none"
@@ -2,1 +2,1 @@
diff a//git/repro/taplo/thing.toml b//git/repro/taplo/thing.toml
--- a//git/repro/taplo/thing.toml
+++ b//git/repro/taplo/thing.toml
@@ -0,2 +0,2 @@
-space="none"
+space = "none"
# thing.toml

@@ -2,1 +2,1 @@
diff a//git/repro/taplo/thing.toml b//git/repro/taplo/thing.toml
--- a//git/repro/taplo/thing.toml
+++ b//git/repro/taplo/thing.toml
@@ -0,2 +0,2 @@
# thing.toml

@@ -2,1 +2,1 @@
-space="none"
+space = "none"
diff a//git/repro/taplo/thing.toml b//git/repro/taplo/thing.toml
--- a//git/repro/taplo/thing.toml
+++ b//git/repro/taplo/thing.toml
# thing.toml

@@ -2,1 +2,1 @@
-space="none"
+space = "none"
@@ -0,2 +0,2 @@

created time in 3 days

issue commenttamasfe/taplo

`--stdin-filepath` should affect application of rules

It's not an issue with --stdin-filepath, it doesn't reorder keys without it either

I assume what you mean is that if you run cat path/to/thing.toml | taplo format --config ./taplo.toml - then it does not reorder x and y.

Yes, obviously -- in this case there is no possibility that it could apply a rule which only applies to "path/to/thing.toml".

But after being informed that the stdin filepath is "path/to/thing.toml", then rules which apply to "path/to/thing.toml" should get applied. Not applying them is unexpected behavior.

dtolnay

comment created time in 3 days

issue openedtamasfe/taplo

`--stdin-filepath` should affect application of rules

Currently if I have a config file like:

# taplo.toml

include = [
    "path/to/thing.toml",
    # ...
]

[formatting]
reorder_keys = false

[[rule]]
include = ["path/to/thing.toml"]
keys = ["dependencies", "target.*.dependencies"]
[rule.formatting]
reorder_keys = true
# path/to/thing.toml

[dependencies]
y = 1
x = 1

then, running taplo format --config ./taplo.toml path/to/thing.toml, it correctly applies reorder_keys to reorder x before y.

But if I run taplo format --config ./taplo.toml --stdin-filepath path/to/thing.toml - <path/to/thing.toml, x and y are not reordered, despite the applicable rule.

I would have expected rules to apply based on stdin-filepath.

Mentioning @lffg since --stdin-filepath was introduced by you in #250.

created time in 3 days

PR merged serde-rs/json

Add an example of producing a Null in a json! literal

I tried to do this, and while you can piece together the way to do this from the interpolation comment, it's the one piece of direct JSON syntax that isn't immediately obvious.

+2 -1

2 comments

1 changed file

ndmitchell

pr closed time in 3 days

push eventserde-rs/json

Neil Mitchell

commit sha 0d7b0d3c18166bb65643afda9651e962b6f03d55

Add an example of producing a Null in a json! literal I tried to do this, and while you can piece together the way to do this from the interpolation comment, it's the one piece of direct JSON syntax that isn't immediately obvious.

view details

Neil Mitchell

commit sha 009a53b472017dbec18442611fb849b9801db41d

Switch to using null

view details

David Tolnay

commit sha 6fda3853e4b5cd2d6e2e7cc773f453999498a8cb

Merge pull request 1021 from ndmitchell/patch-2

view details

push time in 3 days

PullRequestReviewEvent

issue commentdtolnay/oqueue

[Help] Adapting oqueue to work with files

It wouldn't still be in the queue if it was done.

That is what the loop above the snippet you quoted accomplishes.

jpmckinney

comment created time in 5 days

release dtolnay/linkme

0.3.10

released time in 5 days

push eventdtolnay/linkme

David Tolnay

commit sha 65a95be8ada66b31382af7b669ffb594b5c1e7e0

Release 0.3.10

view details

push time in 5 days

created tagdtolnay/linkme

tag0.3.10

Safe cross-platform linker shenanigans

created time in 5 days

PR merged dtolnay/linkme

Add support for Android.

Treat it the same as Linux.

+14 -11

0 comment

3 changed files

qwandor

pr closed time in 5 days

more