소스 검색

Merge pull request #4910 from Feoramund/fix-strings-clone-2x-slice

Remove unneeded slicing in `strings.clone`
Laytan 7 달 전
부모
커밋
7d26edb83c
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/strings/strings.odin

+ 1 - 1
core/strings/strings.odin

@@ -25,7 +25,7 @@ Returns:
 clone :: proc(s: string, allocator := context.allocator, loc := #caller_location) -> (res: string, err: mem.Allocator_Error) #optional_allocator_error {
 	c := make([]byte, len(s), allocator, loc) or_return
 	copy(c, s)
-	return string(c[:len(s)]), nil
+	return string(c), nil
 }
 /*
 Clones a string safely (returns early with an allocation error on failure)