Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor std/strscans improvements #24566

Merged
merged 3 commits into from
Dec 25, 2024
Merged

Conversation

ire4ever1190
Copy link
Contributor

@ire4ever1190 ire4ever1190 commented Dec 24, 2024

Removes UnInit warnings when using scanTuple

e.g. this would emit a warning

import std/strscans

proc main() =
  let (ok, number) = "123".scanTuple()

image

Error for wrong type now points to the passed in variable

import std/strscans

var str: string
discard "123".scanf("$i", str)

it gave this warning before
image
now it returns
image

@Araq Araq merged commit 5b9ff96 into nim-lang:devel Dec 25, 2024
18 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 5b9ff96

Hint: mm: orc; opt: speed; options: -d:release
178147 lines; 8.716s; 653.848MiB peakmem

@ire4ever1190 ire4ever1190 deleted the fix/strscans-warnings branch December 25, 2024 09:21
narimiran pushed a commit that referenced this pull request Jan 15, 2025
#### Removes UnInit warnings when using `scanTuple`

e.g. this would emit a warning
```nim
import std/strscans

proc main() =
  let (ok, number) = "123".scanTuple()
```

![image](https://github.com/user-attachments/assets/68170ac6-402d-48b0-b8b6-69e71f4b70ae)

#### Error for wrong type now points to the passed in variable

```nim
import std/strscans

var str: string
discard "123".scanf("$i", str)
```

it gave this warning before

![image](https://github.com/user-attachments/assets/096e56d2-0eb5-4c67-9725-25caa97afebd)
now it returns

![image](https://github.com/user-attachments/assets/736a4292-2f56-4cf3-a27a-677045377171)

(cherry picked from commit 5b9ff96)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants