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

Parsing rust cratename from toml, instead of filepath #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

diajowe
Copy link
Contributor

@diajowe diajowe commented May 16, 2024

What this does

Panic-Analyzer pulls the crate name of the analyzed crate from the respective Cargo.toml file instead of pulling it out of the directory path

Why is this desired?

Since the crate name is not necessarily included in the filepath to a crate, it is safer to pull the crate name from the crate's Cargo.toml instead of the crate's file path

How is this achieved?

We are using the toml crate to parse toml files. To do so, the toml file is read into string (since the toml crate does not yet allow parsing of the toml from file directly). This should be ok since toml files are usually not gigabytes in size. The toml is then parsed for the "name" key under the "package" section.

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.

1 participant