1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Use log crate instead of eprintln & remove some unwraps (#5010)

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

- I fixed the TODO to use the `log` crate instead of `eprintln`
- Set the rust-version in the `scripts/check.sh` to the same as egui is
on
- I made xtask use anyhow to remove some unwraps 

* [x] I have followed the instructions in the PR template
This commit is contained in:
Nicolas
2024-09-13 14:23:13 +02:00
committed by GitHub
parent 66076101e1
commit 1488ffa35a
13 changed files with 31 additions and 23 deletions

View File

@@ -775,22 +775,22 @@ mod tests {
fn test_ray_intersection() {
let rect = Rect::from_min_max(pos2(1.0, 1.0), pos2(3.0, 3.0));
eprintln!("Righward ray from left:");
println!("Righward ray from left:");
assert!(rect.intersects_ray(pos2(0.0, 2.0), Vec2::RIGHT));
eprintln!("Righward ray from center:");
println!("Righward ray from center:");
assert!(rect.intersects_ray(pos2(2.0, 2.0), Vec2::RIGHT));
eprintln!("Righward ray from right:");
println!("Righward ray from right:");
assert!(!rect.intersects_ray(pos2(4.0, 2.0), Vec2::RIGHT));
eprintln!("Leftward ray from left:");
println!("Leftward ray from left:");
assert!(!rect.intersects_ray(pos2(0.0, 2.0), Vec2::LEFT));
eprintln!("Leftward ray from center:");
println!("Leftward ray from center:");
assert!(rect.intersects_ray(pos2(2.0, 2.0), Vec2::LEFT));
eprintln!("Leftward ray from right:");
println!("Leftward ray from right:");
assert!(rect.intersects_ray(pos2(4.0, 2.0), Vec2::LEFT));
}
}

View File

@@ -56,9 +56,6 @@ pub fn best_in_range_f64(min: f64, max: f64) -> f64 {
let min_str = to_decimal_string(min / exp_factor);
let max_str = to_decimal_string(max / exp_factor);
// eprintln!("min_str: {:?}", min_str);
// eprintln!("max_str: {:?}", max_str);
let mut ret_str = [0; NUM_DECIMALS];
// Select the common prefix: