diff&cmp not suitable to be called as library functions.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 276
- Forks
- 39
- Ø Merge
- 3 Std. 27 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
Problems with using diffutils.rs as a library:
- ExitCode is intended to be consumed only by the standard library ... For forwards compatibility with potentially unusual targets, this type currently does not provide Eq, Hash, or access to the raw value. ... so it seems library callers (such as myself) would prefer an i32.
- The exit(2) is worrying for library callers who don't want to be suddenly killed.
I got the hy3 model to create a fix for this for me. But it lumped it all into one big commit: https://github.com/gmatht/diffutils/commit/4bdd5219adf1485aaf60114ba10adf7e3a26ac7e
Should I make a pull request including two commits:
- Replace the ExitCode/exit() convention with i32 returns, everywhere except at the very top main function.
- Add Tests that ensure errors return an appropriate i32 instead of aborting the whole process.
Also should 1./2. be split into updating diff.rs and updating cmp.rs, resulting in 4 commits? If so, main should also should still be updated in each commit so e.g. it doesn't break the build.
Do you prefer that the test or the fix be commited first?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Durchsicht von diff.rs und cmp.rs. Untersuche anschließend die main-Funktion der obersten Ebene und den verknüpften Fix-Commit auf das aktuelle Verhalten von ExitCode und exit(). Prüfe, wie die Tests organisiert sind, und füge Abdeckung für Fehler-Rückgaben ohne Prozessbeendigung hinzu. Als erledigt gilt die Aufgabe, wenn beide Befehle weiterhin buildbar sind, Aufrufer der Bibliothek geeignete i32-Ergebnisse erhalten und nur die main-Funktion der obersten Ebene den Prozess beendet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- api, cli
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 64/100