Skip to content

Commit 739ff24

Browse files
committed
Lint fix
1 parent 591be15 commit 739ff24

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

packages/renderers-rust-cpi/README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,16 @@ The Rust renderer provides sensible default traits when generating the various R
5757

5858
Using the `traitOptions` attribute, you may configure the default traits that will be applied to every Rust type. These default traits can be configured using 4 different attributes:
5959

60-
- `baseDefaults`: The default traits to implement for all types.
61-
- `dataEnumDefaults`: The default traits to implement for all data enum types, in addition to the `baseDefaults` traits. Data enums are enums with at least one non-unit variant — e.g. `pub enum Command { Write(String), Quit }`.
62-
- `scalarEnumDefaults`: The default traits to implement for all scalar enum types, in addition to the `baseDefaults` traits. Scalar enums are enums with unit variants only — e.g. `pub enum Feedback { Good, Bad }`.
63-
- `structDefaults`: The default traits to implement for all struct types, in addition to the `baseDefaults` traits.
60+
- `baseDefaults`: The default traits to implement for all types.
61+
- `dataEnumDefaults`: The default traits to implement for all data enum types, in addition to the `baseDefaults` traits. Data enums are enums with at least one non-unit variant — e.g. `pub enum Command { Write(String), Quit }`.
62+
- `scalarEnumDefaults`: The default traits to implement for all scalar enum types, in addition to the `baseDefaults` traits. Scalar enums are enums with unit variants only — e.g. `pub enum Feedback { Good, Bad }`.
63+
- `structDefaults`: The default traits to implement for all struct types, in addition to the `baseDefaults` traits.
6464

6565
Note that you must provide the fully qualified name of the traits you provide (e.g. `serde::Serialize`). Here are the default values for these attributes:
6666

6767
```ts
6868
const traitOptions = {
69-
baseDefaults: [
70-
'Clone',
71-
'Debug',
72-
'Eq',
73-
'PartialEq',
74-
],
69+
baseDefaults: ['Clone', 'Debug', 'Eq', 'PartialEq'],
7570
dataEnumDefaults: [],
7671
scalarEnumDefaults: ['Copy', 'PartialOrd', 'Hash', 'num_derive::FromPrimitive'],
7772
structDefaults: [],

packages/renderers-rust-cpi/src/fragments/modPage.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export function getModPageFragment(
1111
return getPageFragment(imports, scope);
1212
}
1313

14-
export function getModImportsFragment(
15-
items: { name: CamelCaseString }[],
16-
): Fragment | undefined {
14+
export function getModImportsFragment(items: { name: CamelCaseString }[]): Fragment | undefined {
1715
if (items.length === 0) return;
1816

1917
const sortedItems = items.slice().sort((a, b) => a.name.localeCompare(b.name));
@@ -26,6 +24,5 @@ export function getModImportsFragment(
2624
cs => cs.join('\n'),
2725
);
2826

29-
return mergeFragments([modStatements, useStatements], cs => cs.join('\n\n'))
30-
27+
return mergeFragments([modStatements, useStatements], cs => cs.join('\n\n'));
3128
}

packages/renderers-rust-cpi/src/visitors/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export * from './getRenderMapVisitor';
33
export * from './getTypeManifestVisitor';
44
export * from './renderValueNodeVisitor';
55
export * from './renderVisitor';
6-

packages/renderers-rust-cpi/test/utils/traitOptions.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('default values', () => {
3232
// Then we expect the following traits to be rendered.
3333
expect(content).toBe(
3434
`#[derive(Clone, Debug, Eq, PartialEq)]\n` +
35-
`#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]\n` +
35+
`#[cfg_attr(feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize))]\n` +
3636
`#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]\n`,
3737
);
3838

@@ -331,7 +331,9 @@ describe('overridden traits', () => {
331331
});
332332

333333
// Then we expect some of the overridden traits to be rendered under feature flags.
334-
expect(content).toBe(`#[derive(MyNonFeatureTrait)]\n#[cfg_attr(feature = "custom", derive(MyFeedbackTrait))]\n`);
334+
expect(content).toBe(
335+
`#[derive(MyNonFeatureTrait)]\n#[cfg_attr(feature = "custom", derive(MyFeedbackTrait))]\n`,
336+
);
335337
});
336338
});
337339

0 commit comments

Comments
 (0)