frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Google's Rust Style Guide

https://google.github.io/styleguide/rustguide.html
62•kaycebasques•1h ago

Comments

Thanemate•58m ago
Not trying to rain on someone's parade but, the only reason why would care about style guides nowadays is to feed them to our model of choice and let it do what it's supposed to be doing.

So it's not like I am willing to read through this and think to myself "I cannot wait to pick up some new ways of doing things". I'm the general to my agentic army now.

I guess you would code manually every now and then for your own enjoyment but at that point do you care about style guides written for scale?

gatlin•48m ago
Seems very much like your goal was to rain on a parade.
u1hcw9nx•46m ago
Not trying to rain on someone's parade, but the only reason I would care about HN comments nowadays is to feed them to my model of choice and let it generate the contrarian hot takes it's supposed to be generating. So it's not like I am willing to read through this thread and think to myself "I cannot wait to pick up some new ways of complaining about documentation." I'm the Editor-in-Chief to my synthetic pundit army now.

I guess you would type out a comment manually every now and then for your own enjoyment, but at that point do you really care about comments at scale?

---

EDIT (above is a joke) It's very important that every time you find something that is of no use to you, you write a comment explaining that this link is of no interest to you, discouraging people from things you have no interest in. Monoculture for all!

anonymous908213•45m ago
> I'm the general to my agentic army now.

What have you produced with your agentic army? Would you like to share with the class?

bigfishrunning•29m ago
my guess is a lot of heat, some water vapor....
monocasa•43m ago
The point of style guides is to optimize for readability despite a cognitively diverse workforce coding in the same repos.

I would think they're probably even more meaningful in an agentic world.

Shitty generals can't review meaningfully review the work of their troops.

On top of that all, I just enjoy programming itself. It's less and less of the meat of a software job over time, but I was coding before I got paid for it, and I'll probably keep coding well after I can get paid for it.

mkagenius•22m ago
> Shitty generals can't review meaningfully review the work of their troops.

Except that reviewing has become just asking your agent what that piece of code does in english. Reading code has a bit of cognitive load, that we will probably drop it in coming years

smoe•42m ago
First paragraph: “includes guidance on API and implementation design”

It seems to me that if the intent is not just to produce code but also to operate it, having the different pieces behave in a similar, predictable way is kind of nice. Whether the software is written by AI or humans.

nimih•38m ago
I'm not sure I really agree with your main point (I think it's probably still important for LLM-generated code to be generally human-understandable, at least if you care about long-term maintainability), but setting that aside to answer this question:

> I guess you would code manually every now and then for your own enjoyment but at that point do you care about style guides written for scale?

I think they're still quite valuable in that case, for a couple reasons:

- When learning a new language (which happens much more frequently when writing code "for pleasure," as it were), "written for scale" guidelines still translate pretty well to "written for oneself" IME. At the very least, they tell you what to expect in code you read, and give you a reasonable starting point as you develop your own taste and stylistic preferences.

- I've noticed some open source projects beginning to institute anti-AI contribution guidelines, and such projects still benefit from codified style guides. Google obviously doesn't fall under this category themselves, but in other language ecosystems, their style guides tend to find use in OSS projects.

petersellers•38m ago
Are you saying that you don't ever look at the code once it's been generated?
yodsanklai•34m ago
This is what we do in my company, give the guidelines to the model. Unfortunately, the model isn't always following them and it's impossible to enforce them manually. There's too much code to review, the code is generally low quality, and is more often than not auto-approved by AI.

Unless you're working on your own project on which you have full control, or you have a strong authority figure in your company who cares about that, it's a lost battle.

It's sad for anyone who love their craft, but tbh I'm not even sure it matters anymore for most projects.

oddCopper65•46m ago
The enum-over-bool rule is the one I'd keep even solo, saved me a reversed flag in a cert validator once.
sebastianconcpt•33m ago
This is a sub-case of the general one that is narrowing the interpretation of things. A big infinite amount of things can be true or false, only one can be a Rust variant.
petcat•38m ago
At this point, is anybody writing new C or C++? It seems like they are sunset languages even at the big corps.
icase•37m ago
grownups with important jobs write C
thomashabets2•29m ago
Are you just being snarky, or do you have something more specific to say about something that's choosing C?

Considering that it's been 54 years, and we've yet to find any human being, any at all[1], who can write C without UB, I'd say that writing C in 2026 when there's any other option is basically misconduct and a good case could be made that if the code touches money in any way, then it could be a SOX violation too.

Writing C today is like still writing Cobol. Yes, if you are adding a new type of savings account to your bank, and the rest is in Cobol, then sure write it in Cobol.

Some microcontroller projects may have an ecosystem in C that makes other options harder in practice, but it's still a worthy investment to not use C. There's a reason phone baseband firmwares are moving away from C.

[1] No, not even djb, who people like to bring up.

dnautics•20m ago
> who can write C without UB

Sel4?

anonymous908213•15m ago
> Are you just being snarky,

They aren't being snarky, they're stating a fact. Rust, rounding to the nearest percent, does not exist. It's a trendy language among the Silicon Valley types that HN draws, but 99.9% of the world runs on C/++, OSes written in C/++, and language VMs implemented in C/++. Maybe some day it will change, but hanging around here too much will give you a very skewed idea of how widely adopted it is.

icase•37m ago
no amount of stylistic heterogeneity can make this awful language pleasant
sebastianconcpt•31m ago
The good emotions come with the confidence in the engineering quality that it gives you as output (once you overcome the friction, which AI can help you big time to achieve).
monocasa•34m ago
Can anyone expand on the chromium specifc guidelines on super tiny crates, particularly no nesting of modules/source files?

That feels like the ~2010 era of people saying that functions should be as small as possible. That lead me to reviewing a lot of code where every function was one or two lines and you couldn't actually see what was going on anymore through the layers of unneeded abstraction.

I want to give chrome the benefit of the doubt, but that seems really goofy.

loeg•29m ago
Maybe one or two line functions are a totally different scale than "all source code files in a crate"? So like, one is problematic in a way the other is not. And the guidance is "prefer small," not "always super tiny." See: "Larger crates are allowed" later on. And also see: "Rationale: Fine-grained library targets are recommended in Chromium due to the massive size of our codebase, non-local effects of adding dependencies in the build graph, and to improve performance of parallel compilation and build caching."
dnautics•22m ago
Compilation speed?
skohan•21m ago
It might have to do with optimizing compile times. A crate is the unit of compilation, so small crates increase the likelihood that you won't end up recompiling a lot of unrelated code.

I guess smaller crates and avoiding nested modules could also help optimize for making the code greppable by coding agents without blowing up context windows.

evmar•9m ago
JoeDohn•29m ago
This is nice, I have been lurking on google and meta rust projects, mimicking and picking style by prompting LLMs to distill it, taking a look at fmt & clippy configs helps too.

But it wasn't as coherent and reliable from project to project like this guide. Kudos to google on this one !

i2talics•4m ago
Much of this is very standard across the Rust ecosystem but it's very helpful to have it all in one place.
clifflocked•4m ago
> Considering that it's been 54 years, and we've yet to find any human being, any at all[1], who can write C without UB

Undefined behavior does not mean that a language is useless. C is quite nice to write as an abstraction over assembly, and I highly recommend writing C code and thinking about (and checking) what assembly it compiles into.

Also, it is possible to verify that the types of UB that you are referring to do not occur: see the seL4 project, which provides machine-checked proofs for an OS kernel that no execution can reach a state that is undefined by the language specification.

tkz1312•35m ago
I've been extracting a lot of verified C from theorem provers recently.
neutronicus•32m ago
C++ seems alive and well in the defense space. The big contractors near me have tons of C++ job postings and I don't think I've seen a single one looking for Rust.
thomashabets2•26m ago
Do you know if the code bases are of the kind where dynamic memory (among many other features) is disallowed?
neutronicus•22m ago
Some of them, probably.

From the job postings, many of them seem to be physics simulations of various kinds where (in my experience) memory is allocated on the heap without a second thought. Well, there are second thoughts, but those second thoughts are about performance.

loeg•29m ago
Plenty of new C++ going on at my BigCorp employer.
fasterik•29m ago
I'm pretty sure most big software projects (Windows, Linux, Chrome, gcc, LLVM, AAA game engines, ...) are still writing a lot of new C and C++. Pretty much everyone in the embedded world as well.

As a solo programmer, I still prefer C and C++. In fact, as I've incorporated LLMs in to my workflow, I've been increasingly drawn toward C and its simplicity. A lot of the QoL features of C++ simply aren't needed when you're writing less code manually.

skohan•20m ago
C/C++ is still relevant for HPC, where you want to carefully optimize memory management.
IshKebab•13m ago
Yes mine is, because they have a huge amount of C++ already and none of it is publicly accessible so security isn't a concern. (Obviously there are many other reasons to prefer Rust, but that is a big one.)
npalli•7m ago
Far from it. Until Rust can read C++ code seamlessly, there will be more code written in C++ than Rust for the foreseeable future. HPC, Finance, AI, Games, Databases, Hardware all continue to be written in C++.
In Cargo-built Rust, a crate is costly in terms of abstraction because it needs its own directory, Cargo.toml, src/ subdir, etc. In the Google build systems I've worked with in the past (and it looks like Chromium follows) they instead put source files in the same directory mixing languages and with finer-grained libraries as they see fit.

Given that a crate is the unit of build parallelization in Rust, there's a benefit to more crates especially when they don't cost much cognitive overhead. You could imagine using crates in the way you'd typically use separate mods in a normal Rust project.

I dug around in their code search to find some examples but didn't see much Rust in there, seems still early. I think https://source.chromium.org/chromium/chromium/src/+/main:tes... has ~4 Rust files that end up separate crates though. (One of them defines a proc macro so even in a Cargo built Rust project it would need to be in its own separate crate, I think!)

evmar•7m ago
It looks like there's some macro-based import that does import by path, so crate names are generated:

https://source.chromium.org/chromium/chromium/src/+/main:tes...

Mistral Large 4

https://docs.mistral.ai/models/mistral-large-4-0
203•funnym0nk3y•1h ago•48 comments

Today's PHP security release, and how we're strengthening security

https://thephp.foundation/blog/2026/10/21/todays-php-security-release-and-how-were-strengthening-...
453•ejohnso49•4h ago•217 comments

GitLab CVSS 10.0 Integer Overflow issue

https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-5-1-released/
61•artooro•1h ago•11 comments

Google's Rust Style Guide

https://google.github.io/styleguide/rustguide.html
64•kaycebasques•1h ago•41 comments

Why Windows 11 still ships with Windows 95's memory manager hidden inside it

https://www.windowslatest.com/2026/10/19/why-windows-11-still-ships-with-windows-95s-memory-manag...
52•khalidkhair•1d ago•28 comments

Compromised LiteLLM 1.107.0 on PyPI Installs a Credential Stealer and Backdoor

https://safedep.io/litellm-pypi-compromise-credential-stealer-backdoor/
324•abhisek•6h ago•113 comments

Eight Bits of Trust: eMudhra's CA keys cracked in milliseconds

https://scotthelme.co.uk/eight-bits-of-trust-emudhras-ca-keys-cracked-in-milliseconds/
746•hkc•11h ago•362 comments

DuckDB 2.0.0 LTS “Cinnamon Teal”

https://duckdb.org/2026/10/21/announcing-duckdb-200
314•nnx•6h ago•35 comments

EA is shutting down BioWare

https://www.theverge.com/games/1015647/ea-is-shutting-down-bioware
320•aaronbrethorst•3h ago•197 comments

After automation: Solo founding will be the default

https://every.to/thesis-statements/julian-weisser
14•rmason•49m ago•8 comments

Tiny possum and glider thought extinct for 6000 years found in remote West Papua

https://www.bbc.com/news/articles/cp814l80pw2o
110•bryanrasmussen•1d ago•17 comments

Patch the Planet: global response coordination as agents uncover vulnerabilities

https://openai.com/index/coordinated-disclosure-of-critical-vulnerabilities/
192•nr378•6h ago•126 comments

Oregon lawmakers approve money to buy an iconic waterfall listed on Redfin

https://apnews.com/article/oregon-waterfall-for-sale-lawmakers-996de63462d49ec3ad9bee1629fb9488
139•surprisetalk•5h ago•74 comments

PHP 8.2.35

https://github.com/php/php-src/releases/tag/php-8.2.35
898•tuyuri•6h ago•506 comments

New plastic pollution discovered: 'Plasticorals' coral rubble fused with plastic

https://www.oist.jp/news-center/news/2026/9/18/new-form-plastic-pollution-discovered-shores-vulne...
58•giuliomagnifico•4h ago•15 comments

OpenAI models are coming to Google Cloud

https://openai.com/index/openai-models-google-cloud/
170•armcat•7h ago•68 comments

Claude Duet

https://claude.com/product/claude-duet
125•kuberwastaken•1h ago•120 comments

Potential third critical PHP CVE

https://elk.zone/m.webtoo.ls/@elise@katze.sh/117479383721672027
17•mpaepper•1h ago•2 comments

Canary Tokens

https://canarytokens.org/
64•wiradikusuma•1h ago•11 comments

Meta hit with $25B penalty for deceiving users about privacy on Facebook

https://nmdoj.gov/press-release/the-new-mexico-department-of-justice-secures-another-landmark-vic...
9•DeepLogin•1h ago•2 comments

Plex laid off the whole player team

https://forums.plex.tv/t/2026-20-0-beta-ios-and-tvos-4k-dovi-hdr10-won-t-play-infinite-spinning-c...
71•zzyzxd•1h ago•42 comments

A Place Among the Fiddlers

https://longreads.com/2026/10/01/galax-old-fiddlers-convention-music/
6•gmays•1d ago•0 comments

9 Mothers (YC P26) Is Hiring in Austin, TX

https://9mothers.com/careers
1•ukd1•8h ago

Meta ordered to pay $25B penalty in New Mexico Cambridge Analytica case

https://www.cnbc.com/2026/10/21/meta-new-mexico-cambridge-analytica-penalty.html
135•cbg0•2h ago•48 comments

Using thousands of AI agents to uncover new leads in biological data

https://openai.com/index/scaling-ai-research-for-complex-biological-data/
106•raahelb•6h ago•53 comments

The bridge to agent-scale Git infrastructure

https://github.blog/engineering/architecture-optimization/the-bridge-to-agent-scale-git-infrastru...
38•Klaster_1•4h ago•7 comments

Drupal is now light-years ahead of its reputation

https://dri.es/state-of-drupal-presentation-september-2026
90•scottfalconer•1d ago•100 comments

CDC Ignored Request from States to Validate a New Measles Test

https://www.nytimes.com/2026/10/21/health/measles-test-cdc.html
11•gumby•29m ago•0 comments

Your MCU likely escaped the eMudhra intermediate CA compromise

https://danielmangum.com/posts/mcu-emudhra-intermediate-ca-compromise/
43•hasheddan•4h ago•20 comments

Show HN: I told people I'm a convicted felon after 20 years of hiding it

https://buford.bg/
48•buf•4h ago•19 comments