@@ -88,15 +88,12 @@ library TraitLabelStorageLib {
8888 if (traitLabel.fullTraitValues.length != 0 ) {
8989 // try to find matching FullTraitValue
9090 uint256 length = traitLabel.fullTraitValues.length ;
91- for (uint256 i = 0 ; i < length;) {
91+ for (uint256 i = 0 ; i < length; ++ i ) {
9292 FullTraitValue memory fullTraitValue = traitLabel.fullTraitValues[i];
9393 if (fullTraitValue.traitValue == traitValue) {
9494 actualTraitValue = fullTraitValue.fullTraitValue;
9595 break ;
9696 }
97- unchecked {
98- ++ i;
99- }
10097 }
10198 }
10299 // if no match, use traitValue as-is
@@ -121,13 +118,10 @@ library TraitLabelStorageLib {
121118 {
122119 string [] memory result = new string [](keys.length );
123120 uint256 i;
124- for (i; i < keys.length ;) {
121+ for (i; i < keys.length ; ++ i ) {
125122 bytes32 key = keys[i];
126123 TraitLabel memory traitLabel = TraitLabelStorageLib.toTraitLabel (traitLabelStorage[key]); //.toTraitLabel();
127124 result[i] = TraitLabelLib.toLabelJson (traitLabel, key);
128- unchecked {
129- ++ i;
130- }
131125 }
132126 return json.arrayOf (result);
133127 }
@@ -152,11 +146,8 @@ library FullTraitValueLib {
152146 */
153147 function toJson (FullTraitValue[] memory fullTraitValues ) internal pure returns (string memory ) {
154148 string [] memory result = new string [](fullTraitValues.length );
155- for (uint256 i = 0 ; i < fullTraitValues.length ;) {
149+ for (uint256 i = 0 ; i < fullTraitValues.length ; ++ i ) {
156150 result[i] = toJson (fullTraitValues[i]);
157- unchecked {
158- ++ i;
159- }
160151 }
161152 return json.arrayOf (result);
162153 }
@@ -185,13 +176,10 @@ library TraitLabelLib {
185176 if (length != 0 ) {
186177 string memory stringValue = TraitLib.toString (traitValue, displayType);
187178 bytes32 hashedValue = keccak256 (abi.encodePacked (stringValue));
188- for (uint256 i = 0 ; i < length;) {
179+ for (uint256 i = 0 ; i < length; ++ i ) {
189180 if (hashedValue == keccak256 (abi.encodePacked (acceptableValues[i]))) {
190181 return ;
191182 }
192- unchecked {
193- ++ i;
194- }
195183 }
196184 revert InvalidTraitValue (traitKey, traitValue);
197185 }
@@ -263,13 +251,10 @@ library TraitLib {
263251 */
264252 function _bytes32StringLength (bytes32 str ) internal pure returns (uint256 ) {
265253 // only meant to be called in a view context, so this optimizes for bytecode size over performance
266- for (uint256 i; i < 32 ;) {
254+ for (uint256 i; i < 32 ; ++ i ) {
267255 if (str[i] == 0 ) {
268256 return i;
269257 }
270- unchecked {
271- ++ i;
272- }
273258 }
274259 return 32 ;
275260 }
@@ -289,11 +274,8 @@ library EditorsLib {
289274 function aggregate (AllowedEditor[] memory editors ) internal pure returns (Editors) {
290275 uint256 editorsLength = editors.length ;
291276 uint256 result;
292- for (uint256 i = 0 ; i < editorsLength;) {
277+ for (uint256 i = 0 ; i < editorsLength; ++ i ) {
293278 result |= 1 << uint8 (editors[i]);
294- unchecked {
295- ++ i;
296- }
297279 }
298280 return Editors.wrap (uint8 (result));
299281 }
@@ -311,16 +293,11 @@ library EditorsLib {
311293 // optimistically allocate 4 slots
312294 AllowedEditor[] memory result = new AllowedEditor [](4 );
313295 uint256 num;
314- for (uint256 i = 1 ; i < 5 ;) {
296+ for (uint256 i = 1 ; i < 5 ; ++ i ) {
315297 bool set = _editors & (1 << i) != 0 ;
316298 if (set) {
317299 result[num] = AllowedEditor (i);
318- unchecked {
319- ++ num;
320- }
321- }
322- unchecked {
323- ++ i;
300+ ++ num;
324301 }
325302 }
326303 ///@solidity memory-safe-assembly
@@ -356,11 +333,8 @@ library EditorsLib {
356333 */
357334 function toJson (AllowedEditor[] memory editors ) internal pure returns (string memory ) {
358335 string [] memory result = new string [](editors.length );
359- for (uint256 i = 0 ; i < editors.length ;) {
336+ for (uint256 i = 0 ; i < editors.length ; ++ i ) {
360337 result[i] = LibString.toString (uint8 (editors[i]));
361- unchecked {
362- ++ i;
363- }
364338 }
365339 return json.arrayOf (result);
366340 }
0 commit comments