diff&cmp not suitable to be called as library functions.

Đang mở
#280 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
64/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
api, cli

Hướng nghiên cứu

Bắt đầu bằng việc xem xét diff.rs và cmp.rs, sau đó kiểm tra hàm main cấp cao nhất và commit sửa lỗi được liên kết để xác định hành vi hiện tại của ExitCode và exit(). Kiểm tra cách các bài kiểm thử được tổ chức và bổ sung độ bao phủ cho việc trả về lỗi mà không chấm dứt tiến trình. Hoàn thành có nghĩa là cả hai lệnh vẫn có thể build, các trình gọi thư viện nhận được kết quả i32 phù hợp và chỉ hàm main cấp cao nhất xử lý việc thoát tiến trình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problems with using diffutils.rs as a library:

  1. 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.
  2. 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:

  1. Replace the ExitCode/exit() convention with i32 returns, everywhere except at the very top main function.
  2. 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?

Ngôn ngữ chính
Rust
Star
276
Fork
39
Merge trung bình
3 giờ 27 phút
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/diffutils

Tất cả issue của uutils/diffutils

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.