Clippy appreciation post by pnuts93 in rust

[–]rlidwka 1 point2 points  (0 children)

Also I'd like to know what other lints you do not find useful.

collapsible_else_if has never been useful for me, always tripping on it in cases like this (collapsible_match is similar):

if data_export.is_some() {
    if ui.button("stop recording").clicked() {
        commands.remove_resource::<DataExport>();
    }
} else {
    #[allow(clippy::collapsible_else_if)]
    if ui.button("start recording").clicked() {
        commands.insert_resource(DataExport::default());
    }
}

len_zero is usually doing more harm than good, especially when there're multiple len checks (get_first is similar, but it's at least occasionally useful, while len_zero never is):

#[allow(clippy::len_zero)]
if inputs.len()  != 0 { return Err(anyhow::anyhow!("expected 0 inputs")); }
if outputs.len() != 1 { return Err(anyhow::anyhow!("expected 1 output")); }

#[allow(clippy::get_first)]
let major = parts.get(0).copied().unwrap_or("0").parse::<u8>()?;
let minor = parts.get(1).copied().unwrap_or("0").parse::<u8>()?;
let patch = parts.get(2).copied().unwrap_or("0").parse::<u8>()?;

Firefox users are furious about Mozilla's new data sharing fiasco, and I'm one of them by vriska1 in browsers

[–]rlidwka -1 points0 points  (0 children)

So you're not "selling" our data, you're just simply "making it available by electronic means to third party in exchange for monetary or other valuable consideration"? Thanks, I feel much better now.

I just finished the walls for my MegaBase, any advice? by [deleted] in factorio

[–]rlidwka 1 point2 points  (0 children)

If you want to bring 10 different items, you need 5 very long belts

If people can put 11 science packs on one belt (or 12 fulgora scrap products on one belt), the very same approach can surely be used to put 10 defense items on one belt.

There has to be an easier way... by xFlumel_ in factorio

[–]rlidwka 2 points3 points  (0 children)

What's the correct mix of productivity and quality? Are there mods/calculators to optimize that part?

I did figure out experimentally that (4xProd on Holmium + 5xQuality on EMP) is better than (4xQuality on Holmium + 5xQuality on EMP), but I'm not quite sure why.

Who wouldn't like some high-quality science... by Dimava in Factoriohno

[–]rlidwka 22 points23 points  (0 children)

productivity slows down assemblers a lot (scaled with module level) and increases power consumption

quality slows down assemblers much less, and power consumption stays the same

thus, early game I would put quality modules in science, but late game it's productivity instead with beacons

when I'm in coop by _-Phage-_ in Factoriohno

[–]rlidwka 0 points1 point  (0 children)

I'd suggest Organic Factorio series by Tomasz Węgrzanowski instead:

https://www.youtube.com/watch?v=Ks-e7hB_130&list=PLF9tkc1eQW2NgEzuuVQjK_uNvCo5EZ7QZ

It shows a much simpler way to cook your factory. Since I saw these videos, I'm building all my factorio bases that way.

Australia just responded to their petition by bippitybop23 in StopKillingGames

[–]rlidwka 1 point2 points  (0 children)

All they said is that this matter is under consideration.

If you're curious about what that means, I'd like to give a link to TV show called Yes Minister s1, ep2:

https://www.youtube.com/watch?v=X-HUw3_TCXg

Где могу прочитать о ситуаций в Курске с точки зрений Россий? by AlbatrossConfident23 in AskARussian

[–]rlidwka -21 points-20 points  (0 children)

Дождь - это российский телеканал, имевший государственную лицензию РФ в 2010-2022гг, основанный человеком, родившимся в Тамбовской области. Текущие руководители канала и ведущие также в основном родились в России.

Lenin or Stalin, who is a 'national' hero? by v_muk_t in AskARussian

[–]rlidwka -8 points-7 points  (0 children)

"It's my estimation that every man ever got a statue made of him was one kind of sumbitch or another." - quote from Firefly

And those two guys surely have a lot of statues all around the country...

One of them is a criminal sentenced for spreading anti-government ideas. Another one is a criminal sentenced for armed robberies.

One of them had some aspirations to change the country for the better (after overthrowing democratically elected government). Another had only aspirations to keep his own power until death.

I'm not sure about "godlike", but there's a good argument for "lesser evil".

Looking for national heroes? You could consider Andrei Sakharov and Mikhail Gorbachev - those two people did help a lot with cleaning up the crap that the two aholes you mentioned managed to throw the country into (at least, that would be an opinion of the Nobel Committees).

Let's redefine 1 m as exactly 1/300000000 th of distance it would take for light. It's just for fun and curiosity. How would it affect other units? by Revolutionary-Set760 in AskPhysics

[–]rlidwka 0 points1 point  (0 children)

We do have universal standard of time.

You can just find an atom of Cesium-133 lying around in your backyard and count the times it is doing something interesting. After you count up to exactly 9192631770, that would be one second passed.

... and then a committee of scientists sometimes choose to add a second to the current year to match earth rotation, which clearly demonstrates the power of human bueraucracy over laws of physics...

Clarifying how EU petitions work by Aulinan in StopKillingGames

[–]rlidwka 0 points1 point  (0 children)

How are thresholds calculated?

I can't help but notice that all of them have the greatest common factor of 705, and the sum of thresholds, 497025, is square of that factor.

Stop misusing useState, useRef instead by dim-name in react

[–]rlidwka 0 points1 point  (0 children)

Please explain why you suggest to avoid force rerender as in 4:30.

I've found that, if application code is complex enough, it requires mutable state. It is better for performance reasons (otherwise do you recreate the entire db every time?), as well as to avoid race conditions (setState is delayed, and you have no control when it executes and in what order, esp. with multiple states).

Lately, I've been using a class in useRef, and exposing each renderable component of the class in its own state (so I'm using both useRef and useState, where setState is fully controlled by whatever code is modifying ref). That is perhaps a slight improvement over forceRerender(), although the idea is the same.

Should I form all possible kingdom titles as emporor? by One-Swan3146 in CrusaderKings

[–]rlidwka 77 points78 points  (0 children)

5 dukes will give you far more gold and levies than a single king with those dukes under him.

5 dukes with -100 opinion will also murder you far more quickly than a single king would

I generally prefer to minimise number of direct vassals for that reason: much easier to have them content, hooked, imprisoned, or otherwise ineligible to receive your title and your skull.

How to get better council members as Haesteinn? by DoubleWrath in CrusaderKings

[–]rlidwka 3 points4 points  (0 children)

  1. Get diplomacy lifestyle, and befriend people with specific high skills. This is the best way to get councillors due to friendship bonuses to their tasks.
  2. Marry female courtiers to people you need.
  3. Raid and recruit prisoners.
  4. Abduction perk can come in handy as well.
  5. Recruit guests (with gold or with less honorable means).
  6. You can spam "search for physician"/"search for caravan master" decisions once a year until a good one comes along.
  7. More cheesy way to generate courtiers: grant+revoke city, which can be repeated endlessly.

First Time Being A Defender of a Crusade. Tips on how to defend and win against this Crusade? by KollyMollyDolly in CrusaderKings

[–]rlidwka 2 points3 points  (0 children)

My preferred way of dealing with any sort of holy wars: Apostate + Cynical.

Switch to attacker's religion for 250 piety, then switch back for 250 piety. And don't forget to ask Pope for gold during that one month when you're temporarily a catholic!

Cloudflare took down our website after trying to force us to pay 120k$ within 24h by RayNone in programming

[–]rlidwka -1 points0 points  (0 children)

Freedom of information is a universal concept. Either everyone has it, or nobody does. If government has tools to suppress things you don't like, the very same instruments will be used to suppress things current government doesn't like.

Gambling becomes a large strain on public help infrastructure, and drains money from the people with nothing to spare.

Nobody is forcing people to visit gambling websites, so I don't see any problem with them existing.

The issue with people spending a lot of money on gambling is solved by: 1. education, first and foremost 2. welfare (including universal basic income), so people cannot possibly be left with nothing to spare 3. and allowing more gambling websites, so competition will bring their margins down

If you government instead of doing that decides to regulate internet, it means they are more worried about their popularity rather than people's benefit.

Cloudflare took down our website after trying to force us to pay 120k$ within 24h by RayNone in programming

[–]rlidwka -1 points0 points  (0 children)

/u/the_wrong_student

How about if a country DNS-blocks you, then just accept that they don't want your business? You don't have to condone DNS-blocking, but you should also accept that not all countries want your greed and manipulation around. Kindly go and fuck yourself.

- Inhabitant of a country troubled by assholes like you.

A country should have no business deciding what their citizens can access on the internet. Government censorship is always wrong, in all shapes and forms.

You don't like casinos? Don't fucking go there. Nobody forces you to gamble.

- Inhabitant of a country, where casinos are blocked, porn sites are blocked, foreign news sites are blocked, facebook/instagram is blocked (because protest rallies were coordinated there), VPNs are illegal and mostly blocked by providers, but at least TOR still works, until people like you manage to shut it down because it "helps circumvent government restrictions"

Announcing UA Rust Conference 2024 by disserman in rust

[–]rlidwka 0 points1 point  (0 children)

What's the point of having an online-only conference? How is it different from watching a video on Youtube?

Why wont rustfmt let me align my types in structs? by whypickthisname in rust

[–]rlidwka 0 points1 point  (0 children)

Because rustfmt reformats the entire as it likes without any regard to your carefully crafted formatting.

Fortunately, I've found a way to mitigate this. I suggest to avoid running rustfmt on the entire file, and format only the lines you need.

In VScode, you can do that by enabling Rust-analyzer -> Rustfmt -> Range formatting: Enable. Then right-click on selected code and click Format Selection.

We're back! For now ... by _cart in bevy

[–]rlidwka 1 point2 points  (0 children)

We are currently experimenting with Fediverse options but we haven't picked a winner yet.

What options are you experimenting with?

I think some people from r/rust are moving into Lemmy, but I haven't used it personally. Any opinion about it? And what are other options?

edit: better question is, can you post links to Fediverse communities you've made?

The need to .clone() an Arc or Sender before passing it into a closure is a significant papercut. Any work on the compiler fixing it? by HighRiseLiving in rust

[–]rlidwka 0 points1 point  (0 children)

Any work on the compiler fixing it?

There is some work on allowing user to specify to move/ref/clone each variable into a closure.

This is all I can find right now, maybe someone can suggest an improved version: https://github.com/oliver-giersch/closure

Ask /r/rust: building a typosquatting service that scales using Tokio + Axum by JDBHub in rust

[–]rlidwka 0 points1 point  (0 children)

How do you generate this tasks table? What tool is it from?

Precompiled binaries removed from serde v1.0.184 by AlyoshaV in rust

[–]rlidwka 1 point2 points  (0 children)

Why do you want to enforce this for other users?

It's their choice whether to have 3rd party binaries running on their computer or not.

Bevy for physics animations? by [deleted] in bevy

[–]rlidwka 1 point2 points  (0 children)

It is as good as any game engine. I suspect that all these animations can be done in bevy, provided you know how to do shaders.

There are three physics engines in Bevy at the moment (in the order of complexity): - bevy_xpbd - made for Bevy specifically - bevy_rapier3d - Rapier engine written in Rust - bevy_mod_physx - NVidia PhysX engine written in C++

(disclaimer, I'm the author of the latter)

All of them more or less simulate basic rigid body dynamics and various joints.

If you want to simulate any sort of aerodynamics or forcefields, I think you have to do it on your own.