Skip to content
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

Fix remaining issues with array newlines and equal sign spaces #66

Merged
merged 5 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ There are three modes cargo-sort can be used in:
- Will fail with a non-zero exit code if the file is unsorted.
* **-n or --no-format**
- Will **NOT** format the sorted toml. This option only has an effect if writing or printing out.
* **--check-format**
- Checks that after sorting the original input file has not changed.
* **-g or --grouped**
- When sorting keep table key value spacing. If you have dependency groups they will stick but be sorted within the grouping.
The `key_value_newlines` config option needs to be `true` for this to have any effect.
Expand All @@ -36,6 +38,11 @@ Here are the defaults when no `tomlfmt.toml` is found
always_trailing_comma = false
# trailing comma when multi-line
multiline_trailing_comma = true
# the maximum length in bytes of the string of an array object
max_array_line_len = 80
# number of spaces to indent
indent_count = 4
# space around equal sign
space_around_eq = true
# remove all the spacing inside the array
compact_arrays = false
Expand Down
14 changes: 14 additions & 0 deletions examp/equal_sign.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# oh yea
[dependencies]
c="0"
d="0"
a="0"
b="0"

[dependencies.alpha]
version ="0.15"
default-features =false
more-stuff ={sub = false, object = 10 }
dot.key = "foo"
dot.no.space = true
features =["full", "parsing", "printing", "visit-mut"]
282 changes: 282 additions & 0 deletions examp/ru.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
[package]
name = "ruma"
categories = ["api-bindings", "web-programming"]
keywords = ["matrix", "chat", "messaging", "ruma"]
description = "Types and traits for working with the Matrix protocol."
homepage = "https://ruma.io/"
repository = "https://github.com/ruma/ruma"
readme = "README.md"
license = "MIT"
version = "0.9.4"
edition = "2021"
rust-version = { workspace = true }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[features]
api = ["ruma-common/api"]
canonical-json = ["ruma-common/canonical-json", "ruma-events?/canonical-json"]
client = ["dep:ruma-client"]
events = ["dep:ruma-events"]
server-util = ["dep:ruma-server-util"]
signatures = ["dep:ruma-signatures", "canonical-json"]
state-res = ["dep:ruma-state-res"]

# ruma-client feature flags
client-ext-client-api = ["client", "ruma-client?/client-api"]
client-hyper = ["client", "ruma-client?/hyper"]
client-hyper-native-tls = ["client", "ruma-client?/hyper-native-tls"]
client-isahc = ["client", "ruma-client?/isahc"]
client-reqwest = ["client", "ruma-client?/reqwest"]
client-reqwest-native-tls = ["client", "ruma-client?/reqwest-native-tls"]
client-reqwest-native-tls-vendored = ["client", "ruma-client?/reqwest-native-tls-vendored"]
client-reqwest-rustls-manual-roots = ["client", "ruma-client?/reqwest-rustls-manual-roots"]
client-reqwest-rustls-webpki-roots = ["client", "ruma-client?/reqwest-rustls-webpki-roots"]
client-reqwest-rustls-native-roots = ["client", "ruma-client?/reqwest-rustls-native-roots"]

appservice-api-c = ["api", "events", "dep:ruma-appservice-api", "ruma-appservice-api?/client"]
appservice-api-s = ["api", "events", "dep:ruma-appservice-api", "ruma-appservice-api?/server"]
appservice-api = ["appservice-api-c", "appservice-api-s"]

client-api-c = ["api", "events", "dep:ruma-client-api", "ruma-client-api?/client"]
client-api-s = ["api", "events", "dep:ruma-client-api", "ruma-client-api?/server"]
client-api = ["client-api-c", "client-api-s"]

federation-api-c = ["api", "signatures", "dep:ruma-federation-api", "ruma-federation-api?/client"]
federation-api-s = ["api", "signatures", "dep:ruma-federation-api", "ruma-federation-api?/server"]
federation-api = ["federation-api-c", "federation-api-s"]

identity-service-api-c = [
"api",
"dep:ruma-identity-service-api",
"ruma-identity-service-api?/client",
]
identity-service-api-s = [
"api",
"dep:ruma-identity-service-api",
"ruma-identity-service-api?/server",
]
identity-service-api = ["identity-service-api-c", "identity-service-api-s"]

push-gateway-api-c = ["api", "dep:ruma-push-gateway-api", "ruma-push-gateway-api?/client"]
push-gateway-api-s = ["api", "dep:ruma-push-gateway-api", "ruma-push-gateway-api?/server"]
push-gateway-api = ["push-gateway-api-c", "push-gateway-api-s"]

# Required for randomness, current system time in browser environments
js = ["ruma-common/js"]

# Convenience features
rand = ["ruma-common/rand"]
markdown = ["ruma-events?/markdown"]
html = ["dep:ruma-html", "ruma-events?/html"]

# Everything except compat, js and unstable features
full = [
"api",
"client",
"client-ext-client-api",
"events",
"signatures",
"state-res",
"appservice-api",
"client-api",
"federation-api",
"identity-service-api",
"push-gateway-api",
"rand",
"markdown",
"html",
]

# Enable all compatibility hacks. Deprecated.
compat = [
"compat-key-id",
"compat-user-id",
"compat-empty-string-null",
"compat-null",
"compat-optional",
"compat-unset-avatar",
"compat-get-3pids",
"compat-signature-id",
"compat-tag-info",
]

# Allow IDs to exceed 255 bytes.
compat-arbitrary-length-ids = ["ruma-common/compat-arbitrary-length-ids"]

# Don't validate the version part in `KeyId`.
compat-key-id = ["ruma-common/compat-key-id"]

# Allow some user IDs that are invalid even with the specified historical
# user ID scheme.
compat-user-id = ["ruma-common/compat-user-id"]

# Allow some mandatory fields in requests / responses to be missing, defaulting
# them to an empty string in deserialization.
compat-empty-string-null = [
"ruma-common/compat-empty-string-null",
"ruma-client-api?/compat-empty-string-null",
"ruma-events?/compat-empty-string-null",
"ruma-federation-api?/compat-empty-string-null",
]

# Allow certain fields to be `null` for compatibility, treating that the same as
# the field being absent.
compat-null = ["ruma-common/compat-null"]

# Allow certain fields to be absent even though the spec marks them as
# mandatory. Deserialization will yield a default value like an empty string.
compat-optional = ["ruma-common/compat-optional", "ruma-events?/compat-optional"]

# Unset avatars by sending an empty string, same as what Element Web does, c.f.
# https://github.com/matrix-org/matrix-spec/issues/378#issuecomment-1055831264
compat-unset-avatar = ["ruma-client-api?/compat-unset-avatar"]

# Always serialize the threepids response field in `get_3pids::v3::Response`,
# even if its value is an empty list.
compat-get-3pids = ["ruma-client-api?/compat-get-3pids"]

# Accept `message` as an alias for `error` in `upload_signatures::v3::Failure`,
# since that's what Synapse sends.
compat-upload-signatures = ["ruma-client-api?/compat-upload-signatures"]

# Allow extra characters in signature IDs not allowed in the specification.
compat-signature-id = ["ruma-signatures?/compat-signature-id"]

# Allow TagInfo to contain a stringified floating-point value for the `order` field.
compat-tag-info = ["ruma-events?/compat-tag-info"]

# Specific compatibility for past ring public/private key documents.
ring-compat = ["dep:ruma-signatures", "ruma-signatures?/ring-compat"]

# unstable: by using any of these, you opt out of all semver guarantees Ruma
# otherwise provides!
unstable-exhaustive-types = [
"ruma-common/unstable-exhaustive-types",
"ruma-appservice-api?/unstable-exhaustive-types",
"ruma-client-api?/unstable-exhaustive-types",
"ruma-federation-api?/unstable-exhaustive-types",
"ruma-identity-service-api?/unstable-exhaustive-types",
"ruma-push-gateway-api?/unstable-exhaustive-types",
"ruma-state-res?/unstable-exhaustive-types",
"ruma-events?/unstable-exhaustive-types",
]
unstable-extensible-events = [
"unstable-msc3246",
"unstable-msc3488",
"unstable-msc3553",
"unstable-msc3954",
"unstable-msc3955",
]
unstable-msc1767 = ["ruma-events?/unstable-msc1767"]
unstable-msc2409 = ["ruma-appservice-api?/unstable-msc2409"]
unstable-msc2448 = [
"ruma-client-api?/unstable-msc2448",
"ruma-events?/unstable-msc2448",
"ruma-federation-api?/unstable-msc2448",
]
unstable-msc2654 = ["ruma-client-api?/unstable-msc2654"]
unstable-msc2666 = ["ruma-client-api?/unstable-msc2666"]
unstable-msc2747 = ["ruma-events?/unstable-msc2747"]
unstable-msc2870 = ["ruma-common/unstable-msc2870"]
unstable-msc2965 = ["ruma-client-api?/unstable-msc2965"]
unstable-msc2967 = ["ruma-client-api?/unstable-msc2967"]
unstable-msc3061 = ["ruma-events?/unstable-msc3061"]
unstable-msc3202 = ["ruma-appservice-api?/unstable-msc3202"]
unstable-msc3245 = ["ruma-events?/unstable-msc3245"]
# Support the m.room.message fallback fields from the first version of MSC3245,
# implemented in Element Web and documented at
# https://github.com/matrix-org/matrix-spec-proposals/blob/83f6c5b469c1d78f714e335dcaa25354b255ffa5/proposals/3245-voice-messages.md
unstable-msc3245-v1-compat = ["ruma-events?/unstable-msc3245-v1-compat"]
unstable-msc3246 = ["ruma-events?/unstable-msc3246"]
unstable-msc3381 = ["ruma-events?/unstable-msc3381"]
unstable-msc3401 = ["ruma-events?/unstable-msc3401"]
unstable-msc3488 = ["ruma-client-api?/unstable-msc3488", "ruma-events?/unstable-msc3488"]
unstable-msc3551 = ["ruma-events?/unstable-msc3551"]
unstable-msc3552 = ["ruma-events?/unstable-msc3552"]
unstable-msc3553 = ["ruma-events?/unstable-msc3553"]
unstable-msc3554 = ["ruma-events?/unstable-msc3554"]
unstable-msc3575 = ["ruma-client-api?/unstable-msc3575"]
unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
unstable-msc3814 = ["ruma-client-api?/unstable-msc3814"]
unstable-msc3927 = ["ruma-events?/unstable-msc3927"]
unstable-msc3930 = ["ruma-common/unstable-msc3930"]
unstable-msc3931 = ["ruma-common/unstable-msc3931"]
unstable-msc3932 = ["ruma-common/unstable-msc3932"]
unstable-msc3954 = ["ruma-events?/unstable-msc3954"]
unstable-msc3955 = ["ruma-events?/unstable-msc3955"]
unstable-msc3956 = ["ruma-events?/unstable-msc3956"]
unstable-msc3983 = ["ruma-client-api?/unstable-msc3983"]
unstable-msc4075 = ["ruma-events?/unstable-msc4075"]
unstable-pdu = ["ruma-events?/unstable-pdu"]
unstable-unspecified = [
"ruma-common/unstable-unspecified",
"ruma-federation-api?/unstable-unspecified",
"ruma-push-gateway-api?/unstable-unspecified",
]

# Private feature, only used in test / benchmarking code
__ci = [
"full",
"compat-upload-signatures",
"unstable-unspecified",
"unstable-msc1767",
"unstable-msc2409",
"unstable-msc2448",
"unstable-msc2654",
"unstable-msc2666",
"unstable-msc2747",
"unstable-msc2870",
"unstable-msc2965",
"unstable-msc2967",
"unstable-msc3061",
"unstable-msc3202",
"unstable-msc3245",
"unstable-msc3245-v1-compat",
"unstable-msc3246",
"unstable-msc3381",
"unstable-msc3401",
"unstable-msc3488",
"unstable-msc3551",
"unstable-msc3552",
"unstable-msc3553",
"unstable-msc3554",
"unstable-msc3575",
"unstable-msc3618",
"unstable-msc3723",
"unstable-msc3814",
"unstable-msc3927",
"unstable-msc3930",
"unstable-msc3932",
"unstable-msc3954",
"unstable-msc3955",
"unstable-msc3956",
"unstable-msc3983",
"unstable-msc4075",
]

[dependencies]
assign = { workspace = true }
js_int = { workspace = true }
js_option = "0.1.1"

ruma-common = { workspace = true }

ruma-client = { workspace = true, optional = true }
ruma-events = { workspace = true, optional = true }
ruma-html = { workspace = true, optional = true }
ruma-server-util = { workspace = true, optional = true }
ruma-signatures = { workspace = true, optional = true }
ruma-state-res = { workspace = true, optional = true }

ruma-appservice-api = { workspace = true, optional = true }
ruma-client-api = { workspace = true, optional = true }
ruma-federation-api = { workspace = true, optional = true }
ruma-identity-service-api = { workspace = true, optional = true }
ruma-push-gateway-api = { workspace = true, optional = true }

[dev-dependencies]
serde = { workspace = true }
Loading
Loading