Can we rename Cargo.toml?

projectname.cargo makes a lot more sense to me.

2 Likes

True, albeit there is a catch. Format *.cargo is undefined while *.toml has specification.

This is already violated by cargo. The Cargo.lock file has a .lock extension, but it's clearly written in TOML.

1 Like

I’d also argue that what goes in a cargo file is a lot more restricted than ā€œeh put any toml in thereā€, so the extension is already unhelpful in that sense in the first place.

I see .jsons and .xml although I haven’t seen a place where you can just put any JSON or XML file. It’s probably common that for general formats like these, the programs don’t accept any valid file.

My visual studio C# projects live in .csproj files and not .xml files even tho on inspection with notepad they’re actually xml files!

im not against setup.cargo or projectname.cargo like .csproj. the extension defines the schema to be a cargo toml schema.

I sure wish that someone with authoritative power like wycats or Alex Chriton would comment here…

I don't see what you want to say with that. I haven't said that all XML files have the file extension .xml, I said that some do.

wycats commented on Github (see first post).

I know, I meant on this thread.

Yeah, but Cargo.lock is explicitly computer generated*, so it not having a .toml extension is good. It being .toml helps the system recognize it as a TOML file, albeit one with a specific structure** while keeping the computer generated one without a recognizable extension.

*If I recall the documentation say your changes will be overwritten. ** This is par for the course, lots of config file with specific structure are written in .xml, .yaml, .json, etc.

Another way of putting that is ā€œThe fact that the lock is toml is an implementation detail.ā€

1 Like

I prefer lower case names, and projectname.cargo seems fine assuming it being variable doesn’t result in cargo not finding it or issues with having two of them in the same place being ambiguous. I like cargo.toml for not being ambiguous.

I’m fine with Cargo.toml. The C being uppercase doesn’t really bother me. But as @ecl3ctic said, cargo.toml would (IMHO) work better because of naming conventions in Unix.

I don’t really like projectname.cargo because it wouldn’t be always the same for every project. Maybe something like package.cargo would be more appropriate.

3 Likes

I would like to cast one vote for cargo.toml, regardless of capitalizaion.

Keeping the file name standard between projects, I think, is preferable.

I would also like to vote for cargo.toml, lower cased, for unix conformity.

1 Like

I prefer cargo.toml, with a fallback to Cargo.toml. The *File convention is broken.

What about just ā€˜cargo’ for the file name? Do we need to care about the extension?

I feel its beneficial to have an extension for syntax highlighting purposes. Its easier to detect toml files when they have a toml extension.

So in the absence of wycats' clarification, I have re-read his quote:

Capital letters group it together with other similar configuration files and avoids it from being interspersed with other files and directories.

I am guessing he means that:

  • Cargo* is good because if you are listing files in alphabetical order, it means that the file is at the top.
  • *.toml is good, because it means that the file is highlighted nicely.

For the reasons posted here I still prefer cargo.toml, but implying that wycats is being irrational here is a mistake.

I support renaming Cargo.lock, because it screws up autocomplete when editing the Cargo.toml file :smile:

3 Likes