println/format strings only support a bare {} (no float precision, width or radix)
Maintainer thường phản hồi trong vòng 1 ngày
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
- 48/100
Hướng nghiên cứu
Start by locating the parser and formatter implementation for println format strings, then trace how placeholders are parsed and how f64 values are rendered. The issue gives a reproducer using {:.2} and describes desired precision, width, padding, alignment, and integer radix support. Add the supported formatting behavior and tests for those cases; done when the reproducer formats the float as requested and unsupported syntax is handled consistently.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature request: println / format strings accept only a bare {}. There is no way to control the number of fraction digits of a float, width or padding.
Repro
fun main() {
var c: f64 = 0.1;
println("{:.2}", c);
}
error[E2001]: failed to parse Wave source: unsupported format placeholder `{:.2}`
The error is clear, so this is not a diagnostics problem. The gap is that {} on an f64 always prints six fraction digits (0.100000), so a program that wants 0.10, or the full precision of a double, has to format the number by hand.
I hit this while writing a JSON library in Wave: I had to implement shortest round-trip and fixed-precision double formatting myself just to print a number the way I wanted.
Suggestion
Support at least {:.N} (precision) for floats, and ideally width/fill/alignment ({:5}, {:>8}, {:08}) and an integer radix ({:x}), or document that formatting is expected to be done in library code.
Version
wavec 0.2.1-pre-beta (LLVM 21.1.8), Ubuntu 26.04, x86_64.
- Ngôn ngữ chính
- Rust
- Star
- 56
- Fork
- 21
- Merge trung bình
- 23 giờ 20 phút
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wavefnd/Wave
-
Reject unrepresentable POSIX listener descriptors before Unix-domain acceptCó thể đã có người làm @ShahadatTest đã nhận 6 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
wavefnd/Wave#1082 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Preserve expression assembly result types when recording HIR conversionsCó thể đã có người làm @hiyouwhatsapp đã nhận 1 ngày trước. Đang mởbug help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Preserve the previous build output when writing its Cargo receipt failsCó thể đã có người làm @hiyouwhatsapp đã nhận 2 ngày trước. Đang mởbug build help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Reconcile obsolete staging assets before verifying a new Nightly generationCó thể đã có người làm @hiyouwhatsapp đã nhận 2 ngày trước. Đang mởbug ci help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Clean master build fails in zune-jpeg error conversion and zero-IV array construction (patch)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
CakeRepository/agentshangout#995 ·
-
area:frontend kind:bug priority:p3 ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày