diff&cmp not suitable to be called as library functions.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 276
- Fork
- 39
- Merge medio
- 3h 27m
- PR unite (30g)
- 3
Descrizione
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?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando diff.rs e cmp.rs, poi ispeziona la funzione main di livello superiore e il commit di correzione collegato per il comportamento attuale di ExitCode ed exit(). Verifica come sono organizzati i test e aggiungi la copertura per i ritorni di errore senza terminazione del processo. Il lavoro è completato quando entrambi i comandi rimangono compilabili, i chiamanti della libreria ricevono risultati i32 appropriati e solo la funzione main di livello superiore gestisce l’uscita del processo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- api, cli
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 64/100