Part of what makes guitar a difficult instrument is there is almost always more than one valid way of playing any given passage.
But often times we read a piece, find a fingering that works and that’s that. We never move beyond that initial pass and maybe a few tweaks here and there. That first pass at fingering is a product of your technique and ability, past experience, and preferences.
Think back to your first guitar lesson or the first piece you played. Were you keen on trying something that was hard to do? No way! We all picked the easiest way to get something done. The first thing I ever played on guitar was Black Sabbath’s Electric Funeral. Why? It was easy. One or two fingers on the left hand, easy picking. Left to their own devices a beginning guitarist might never use their left hand pinky.
We can (and should) do better. Think more about fingerings. Try different things before really beginning to drill something into muscle memory.
How can fingering serve the repertoire being practiced? A legato section may require certain things: no jumping left hand fingers between strings, no early right hand preparation, sequencing the left hand, etc. Similarly, a fast section might mean that easy is the way to go in order to avoid tension and gain some speed. That ease may come at the expense of something else.
As our technique and ability grows and as we are exposed to more repertoire, those instincts around fingering and that first pass when reading a piece will get closer to ideal. An ideal fingering is an individual thing.
There are always options. Explore more of them before committing one to muscle memory, but find a balance. We can’t play a passage differently every time. Explore options, find one that serves the music and your hands, then commit.