Skip to content

Commit 6142f96

Browse files
committed
[Java] Minor formatting tidy up.
1 parent 6175bfa commit 6142f96

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustGenerator.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ private static Optional<FieldsRepresentationSummary> generateFieldsRepresentatio
175175
throw new IllegalStateException("field tokens must include bounding BEGIN_FIELD and END_FIELD tokens");
176176
}
177177
}
178+
178179
return Optional.of(new FieldsRepresentationSummary(representationStruct, numBytes));
179180
}
180181

@@ -265,7 +266,6 @@ private static void generateMessageDecoder(
265266
final int headerSize)
266267
throws IOException
267268
{
268-
269269
final Token msgToken = components.messageToken;
270270
final String messageTypeName = formatTypeName(msgToken.name());
271271
final RustCodecType codecType = RustCodecType.Decoder;
@@ -352,6 +352,7 @@ else if (codecType == RustCodecType.Encoder)
352352
throw new IllegalArgumentException(format("Unknown CodecType %s", codecType));
353353
}
354354
}
355+
355356
return nextCoderType;
356357
}
357358

@@ -671,6 +672,7 @@ private static void writeGroupDecoderTopTypes(
671672
indent(out, 2).append("if count > 0 {\n");
672673
indent(out, 3, "Ok(Either::Left(%s::new(self.%s, count)))\n",
673674
memberDecoderType, contentProperty).append(INDENT).append(INDENT).append("} else {\n");
675+
674676
if (atEndOfParent)
675677
{
676678
indent(out, 3).append("Ok(Either::Right(self.parent.after_member()))\n");
@@ -1202,7 +1204,6 @@ static void generateEncoderScratchStruct(final Ir ir, final OutputManager output
12021204
generateEncoderScratchSliceMethods(writer);
12031205

12041206
writer.append("}\n");
1205-
12061207
}
12071208
}
12081209

@@ -1249,7 +1250,7 @@ static void generateEncoderScratchSliceMethods(final Appendable writer) throws I
12491250
indent(writer).append("}\n");
12501251
}
12511252

1252-
static void generateDecoderScratchStruct(final OutputManager outputManager) throws IOException
1253+
private static void generateDecoderScratchStruct(final OutputManager outputManager) throws IOException
12531254
{
12541255
try (Writer writer = outputManager.createOutput("Scratch Decoder Data Wrapper - codec internal use only"))
12551256
{
@@ -1376,6 +1377,7 @@ private static void generateSingleComposite(final List<Token> tokens, final Outp
13761377
final String originalTypeName = beginToken.applicableTypeName();
13771378
final String formattedTypeName = formatTypeName(originalTypeName);
13781379
final SplitCompositeTokens splitTokens = SplitCompositeTokens.splitInnerTokens(tokens);
1380+
13791381
try (Writer writer = outputManager.createOutput(formattedTypeName))
13801382
{
13811383
appendStructHeader(writer, formattedTypeName, true);
@@ -1421,7 +1423,6 @@ private static void appendStructFields(final Appendable appendable, final List<N
14211423

14221424
appendable.append(",\n");
14231425
}
1424-
14251426
}
14261427

14271428
private void generateMessageHeaderDefault(
@@ -1433,6 +1434,7 @@ private void generateMessageHeaderDefault(
14331434
final HeaderStructure header = ir.headerStructure();
14341435
final String messageTypeName = formatTypeName(messageToken.name());
14351436
final String wrapperName = messageTypeName + "MessageHeader";
1437+
14361438
try (Writer writer = outputManager.createOutput(messageTypeName + " specific Message Header "))
14371439
{
14381440
appendStructHeader(writer, wrapperName, true);
@@ -1476,7 +1478,6 @@ private void generateMessageHeaderDefault(
14761478

14771479
writer.append("}\n");
14781480
}
1479-
14801481
}
14811482

14821483
private static void appendStructHeader(
@@ -1541,6 +1542,7 @@ private static void generateConstantAccessorImpl(
15411542
i += componentTokenCount;
15421543
continue;
15431544
}
1545+
15441546
final String constantRustTypeName;
15451547
final String constantRustExpression;
15461548
switch (signalToken.signal())
@@ -1553,16 +1555,15 @@ private static void generateConstantAccessorImpl(
15531555
constantRustTypeName = "&'static str";
15541556
// TODO - proper string escaping
15551557
constantRustExpression = "\"" + rawValue + "\"";
1556-
15571558
}
15581559
else
15591560
{
1560-
final String constantRustPrimitiveType = RustUtil.rustTypeName(signalToken.encoding()
1561-
.primitiveType());
1562-
constantRustTypeName = getRustTypeForPrimitivePossiblyArray(signalToken,
1563-
constantRustPrimitiveType);
1564-
constantRustExpression = generateRustLiteral(signalToken.encoding().primitiveType(),
1565-
rawValue);
1561+
final String constantRustPrimitiveType = RustUtil.rustTypeName(
1562+
signalToken.encoding().primitiveType());
1563+
constantRustTypeName = getRustTypeForPrimitivePossiblyArray(
1564+
signalToken, constantRustPrimitiveType);
1565+
constantRustExpression = generateRustLiteral(
1566+
signalToken.encoding().primitiveType(), rawValue);
15661567
}
15671568
break;
15681569

0 commit comments

Comments
 (0)