@@ -1279,49 +1279,49 @@ impl<O> AssertKind<O> {
1279
1279
match self {
1280
1280
BoundsCheck { ref len, ref index } => write ! (
1281
1281
f,
1282
- "\" index out of bounds: the len is {{}} but the index is {{}}\" , {:?}, {:?}" ,
1282
+ "\" index out of bounds: the length is {{}} but the index is {{}}\" , {:?}, {:?}" ,
1283
1283
len, index
1284
1284
) ,
1285
1285
1286
1286
OverflowNeg ( op) => {
1287
- write ! ( f, "\" attempt to negate {{}} which would overflow\" , {:?}" , op)
1287
+ write ! ( f, "\" attempt to negate ` {{}}`, which would overflow\" , {:?}" , op)
1288
1288
}
1289
- DivisionByZero ( op) => write ! ( f, "\" attempt to divide {{}} by zero\" , {:?}" , op) ,
1289
+ DivisionByZero ( op) => write ! ( f, "\" attempt to divide ` {{}}` by zero\" , {:?}" , op) ,
1290
1290
RemainderByZero ( op) => write ! (
1291
1291
f,
1292
- "\" attempt to calculate the remainder of {{}} with a divisor of zero\" , {:?}" ,
1292
+ "\" attempt to calculate the remainder of ` {{}}` with a divisor of zero\" , {:?}" ,
1293
1293
op
1294
1294
) ,
1295
1295
Overflow ( BinOp :: Add , l, r) => write ! (
1296
1296
f,
1297
- "\" attempt to compute `{{}} + {{}}` which would overflow\" , {:?}, {:?}" ,
1297
+ "\" attempt to compute `{{}} + {{}}`, which would overflow\" , {:?}, {:?}" ,
1298
1298
l, r
1299
1299
) ,
1300
1300
Overflow ( BinOp :: Sub , l, r) => write ! (
1301
1301
f,
1302
- "\" attempt to compute `{{}} - {{}}` which would overflow\" , {:?}, {:?}" ,
1302
+ "\" attempt to compute `{{}} - {{}}`, which would overflow\" , {:?}, {:?}" ,
1303
1303
l, r
1304
1304
) ,
1305
1305
Overflow ( BinOp :: Mul , l, r) => write ! (
1306
1306
f,
1307
- "\" attempt to compute `{{}} * {{}}` which would overflow\" , {:?}, {:?}" ,
1307
+ "\" attempt to compute `{{}} * {{}}`, which would overflow\" , {:?}, {:?}" ,
1308
1308
l, r
1309
1309
) ,
1310
1310
Overflow ( BinOp :: Div , l, r) => write ! (
1311
1311
f,
1312
- "\" attempt to compute `{{}} / {{}}` which would overflow\" , {:?}, {:?}" ,
1312
+ "\" attempt to compute `{{}} / {{}}`, which would overflow\" , {:?}, {:?}" ,
1313
1313
l, r
1314
1314
) ,
1315
1315
Overflow ( BinOp :: Rem , l, r) => write ! (
1316
1316
f,
1317
- "\" attempt to compute the remainder of `{{}} % {{}}` which would overflow\" , {:?}, {:?}" ,
1317
+ "\" attempt to compute the remainder of `{{}} % {{}}`, which would overflow\" , {:?}, {:?}" ,
1318
1318
l, r
1319
1319
) ,
1320
1320
Overflow ( BinOp :: Shr , _, r) => {
1321
- write ! ( f, "\" attempt to shift right by {{}} which would overflow\" , {:?}" , r)
1321
+ write ! ( f, "\" attempt to shift right by ` {{}}`, which would overflow\" , {:?}" , r)
1322
1322
}
1323
1323
Overflow ( BinOp :: Shl , _, r) => {
1324
- write ! ( f, "\" attempt to shift left by {{}} which would overflow\" , {:?}" , r)
1324
+ write ! ( f, "\" attempt to shift left by ` {{}}`, which would overflow\" , {:?}" , r)
1325
1325
}
1326
1326
_ => write ! ( f, "\" {}\" " , self . description( ) ) ,
1327
1327
}
@@ -1332,36 +1332,40 @@ impl<O: fmt::Debug> fmt::Debug for AssertKind<O> {
1332
1332
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1333
1333
use AssertKind :: * ;
1334
1334
match self {
1335
- BoundsCheck { ref len, ref index } => {
1336
- write ! ( f, "index out of bounds: the len is {:?} but the index is {:?}" , len, index)
1337
- }
1338
- OverflowNeg ( op) => write ! ( f, "attempt to negate {:#?} which would overflow" , op) ,
1339
- DivisionByZero ( op) => write ! ( f, "attempt to divide {:#?} by zero" , op) ,
1340
- RemainderByZero ( op) => {
1341
- write ! ( f, "attempt to calculate the remainder of {:#?} with a divisor of zero" , op)
1342
- }
1335
+ BoundsCheck { ref len, ref index } => write ! (
1336
+ f,
1337
+ "index out of bounds: the length is {:?} but the index is {:?}" ,
1338
+ len, index
1339
+ ) ,
1340
+ OverflowNeg ( op) => write ! ( f, "attempt to negate `{:#?}`, which would overflow" , op) ,
1341
+ DivisionByZero ( op) => write ! ( f, "attempt to divide `{:#?}` by zero" , op) ,
1342
+ RemainderByZero ( op) => write ! (
1343
+ f,
1344
+ "attempt to calculate the remainder of `{:#?}` with a divisor of zero" ,
1345
+ op
1346
+ ) ,
1343
1347
Overflow ( BinOp :: Add , l, r) => {
1344
- write ! ( f, "attempt to compute `{:#?} + {:#?}` which would overflow" , l, r)
1348
+ write ! ( f, "attempt to compute `{:#?} + {:#?}`, which would overflow" , l, r)
1345
1349
}
1346
1350
Overflow ( BinOp :: Sub , l, r) => {
1347
- write ! ( f, "attempt to compute `{:#?} - {:#?}` which would overflow" , l, r)
1351
+ write ! ( f, "attempt to compute `{:#?} - {:#?}`, which would overflow" , l, r)
1348
1352
}
1349
1353
Overflow ( BinOp :: Mul , l, r) => {
1350
- write ! ( f, "attempt to compute `{:#?} * {:#?}` which would overflow" , l, r)
1354
+ write ! ( f, "attempt to compute `{:#?} * {:#?}`, which would overflow" , l, r)
1351
1355
}
1352
1356
Overflow ( BinOp :: Div , l, r) => {
1353
- write ! ( f, "attempt to compute `{:#?} / {:#?}` which would overflow" , l, r)
1357
+ write ! ( f, "attempt to compute `{:#?} / {:#?}`, which would overflow" , l, r)
1354
1358
}
1355
1359
Overflow ( BinOp :: Rem , l, r) => write ! (
1356
1360
f,
1357
- "attempt to compute the remainder of `{:#?} % {:#?}` which would overflow" ,
1361
+ "attempt to compute the remainder of `{:#?} % {:#?}`, which would overflow" ,
1358
1362
l, r
1359
1363
) ,
1360
1364
Overflow ( BinOp :: Shr , _, r) => {
1361
- write ! ( f, "attempt to shift right by {:#?} which would overflow" , r)
1365
+ write ! ( f, "attempt to shift right by ` {:#?}`, which would overflow" , r)
1362
1366
}
1363
1367
Overflow ( BinOp :: Shl , _, r) => {
1364
- write ! ( f, "attempt to shift left by {:#?} which would overflow" , r)
1368
+ write ! ( f, "attempt to shift left by ` {:#?}`, which would overflow" , r)
1365
1369
}
1366
1370
_ => write ! ( f, "{}" , self . description( ) ) ,
1367
1371
}
0 commit comments