Skip to content

Commit 55a3412

Browse files
authored
feat: add nightly formatting rules (#552)
1 parent 8e449e8 commit 55a3412

File tree

264 files changed

+4033
-3111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

264 files changed

+4033
-3111
lines changed

.cargo-husky/hooks/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./scripts/pre-commit.sh

.github/workflows/ci.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,26 @@ jobs:
275275
with:
276276
submodules: true
277277

278+
- name: Install nightly rustfmt
279+
uses: actions-rs/toolchain@v1
280+
with:
281+
toolchain: nightly
282+
profile: minimal
283+
components: rustfmt
284+
278285
- name: Install stable toolchain
279286
uses: actions-rs/toolchain@v1
280287
with:
281288
profile: minimal
282289
override: true
283-
components: clippy, rustfmt
290+
components: clippy
284291

285292
- uses: Swatinem/rust-cache@v2
286293

287294
- name: Run cargo fmt
288295
uses: actions-rs/cargo@v1
289296
with:
297+
toolchain: nightly
290298
command: fmt
291299
args: --all -- --check
292300

c/include/mun/abi.h

+28-22
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ enum MunStructMemoryKind
1717
#endif // __cplusplus
1818
{
1919
/**
20-
* A garbage collected struct is allocated on the heap and uses reference semantics when passed
21-
* around.
20+
* A garbage collected struct is allocated on the heap and uses reference
21+
* semantics when passed around.
2222
*/
2323
Gc,
2424
/**
25-
* A value struct is allocated on the stack and uses value semantics when passed around.
25+
* A value struct is allocated on the stack and uses value semantics when
26+
* passed around.
2627
*
27-
* NOTE: When a value struct is used in an external API, a wrapper is created that _pins_ the
28-
* value on the heap. The heap-allocated value needs to be *manually deallocated*!
28+
* NOTE: When a value struct is used in an external API, a wrapper is
29+
* created that _pins_ the value on the heap. The heap-allocated value
30+
* needs to be *manually deallocated*!
2931
*/
3032
Value,
3133
};
@@ -65,10 +67,11 @@ typedef struct MunArrayTypeId {
6567
} MunArrayTypeId;
6668

6769
/**
68-
* Represents a unique identifier for types. The runtime can use this to lookup the corresponding
69-
* [`TypeInfo`]. A [`TypeId`] is a key for a [`TypeInfo`].
70+
* Represents a unique identifier for types. The runtime can use this to lookup
71+
* the corresponding [`TypeInfo`]. A [`TypeId`] is a key for a [`TypeInfo`].
7072
*
71-
* A [`TypeId`] only contains enough information to query the runtime for a [`TypeInfo`].
73+
* A [`TypeId`] only contains enough information to query the runtime for a
74+
* [`TypeInfo`].
7275
*/
7376
enum MunTypeId_Tag
7477
#ifdef __cplusplus
@@ -127,8 +130,8 @@ typedef struct MunFunctionSignature {
127130
} MunFunctionSignature;
128131

129132
/**
130-
* Represents a function prototype. A function prototype contains the name, type signature, but
131-
* not an implementation.
133+
* Represents a function prototype. A function prototype contains the name,
134+
* type signature, but not an implementation.
132135
*/
133136
typedef struct MunFunctionPrototype {
134137
/**
@@ -142,8 +145,8 @@ typedef struct MunFunctionPrototype {
142145
} MunFunctionPrototype;
143146

144147
/**
145-
* Represents a function definition. A function definition contains the name, type signature, and
146-
* a pointer to the implementation.
148+
* Represents a function definition. A function definition contains the name,
149+
* type signature, and a pointer to the implementation.
147150
*
148151
* `fn_ptr` can be used to call the declared function.
149152
*/
@@ -189,7 +192,8 @@ typedef struct MunStructDefinition {
189192
} MunStructDefinition;
190193

191194
/**
192-
* Contains data specific to a group of types that illicit the same characteristics.
195+
* Contains data specific to a group of types that illicit the same
196+
* characteristics.
193197
*/
194198
enum MunTypeDefinitionData_Tag
195199
#ifdef __cplusplus
@@ -216,16 +220,17 @@ typedef union MunTypeDefinitionData {
216220
/**
217221
* Represents the type declaration for a type that is exported by an assembly.
218222
*
219-
* When multiple Mun modules reference the same type, only one module exports the type; the module
220-
* that contains the type definition. All the other Mun modules reference the type through a
221-
* [`TypeId`].
223+
* When multiple Mun modules reference the same type, only one module exports
224+
* the type; the module that contains the type definition. All the other Mun
225+
* modules reference the type through a [`TypeId`].
222226
*
223-
* The modules that defines the type exports the data to reduce the filesize of the assemblies and
224-
* to ensure only one definition exists. When linking all assemblies together the type definitions
225-
* from all assemblies are loaded and the information is shared to modules that reference the type.
227+
* The modules that defines the type exports the data to reduce the filesize of
228+
* the assemblies and to ensure only one definition exists. When linking all
229+
* assemblies together the type definitions from all assemblies are loaded and
230+
* the information is shared to modules that reference the type.
226231
*
227-
* TODO: add support for polymorphism, enumerations, type parameters, generic type definitions, and
228-
* constructed generic types.
232+
* TODO: add support for polymorphism, enumerations, type parameters, generic
233+
* type definitions, and constructed generic types.
229234
*/
230235
typedef struct MunTypeDefinition {
231236
/**
@@ -293,7 +298,8 @@ typedef struct MunDispatchTable {
293298
} MunDispatchTable;
294299

295300
/**
296-
* Represents a lookup table for type information. This is used for runtime linking.
301+
* Represents a lookup table for type information. This is used for runtime
302+
* linking.
297303
*
298304
* Type IDs and handles are stored separately for cache efficiency.
299305
*/

0 commit comments

Comments
 (0)