mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Remove wildcard imports (#5018)
<!-- 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 removed (I hope so) all wildcard imports I found. For me on my pc this improved the build time: - for egui -5s - for eframe -12s * [x] I have followed the instructions in the PR template
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
|
||||
use epaint::{tessellator::Path, *};
|
||||
use epaint::{
|
||||
pos2, tessellator::Path, ClippedShape, Color32, Mesh, PathStroke, Pos2, Rect, Shape, Stroke,
|
||||
TessellationOptions, Tessellator, TextureAtlas, Vec2,
|
||||
};
|
||||
|
||||
fn single_dashed_lines(c: &mut Criterion) {
|
||||
c.bench_function("single_dashed_lines", move |b| {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use crate::{shape::Shape, Color32, PathShape, PathStroke};
|
||||
use emath::*;
|
||||
use emath::{Pos2, Rect, RectTransform};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -762,6 +762,8 @@ fn cubic_for_each_local_extremum<F: FnMut(f32)>(p0: f32, p1: f32, p2: f32, p3: f
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use emath::pos2;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -171,4 +171,4 @@ mod profiling_scopes {
|
||||
}
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use profiling_scopes::*;
|
||||
pub(crate) use profiling_scopes::{profile_function, profile_scope};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::*;
|
||||
use emath::*;
|
||||
use crate::{emath, Color32, TextureId, WHITE_UV};
|
||||
use emath::{Pos2, Rect, Rot2, TSTransform, Vec2};
|
||||
|
||||
/// The 2D vertex type.
|
||||
///
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::{Color32, Margin, Rect, RectShape, Rounding, Vec2};
|
||||
|
||||
/// The color and fuzziness of a fuzzy shape.
|
||||
///
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
text::{FontId, Fonts, Galley},
|
||||
Color32, Mesh, Stroke, TextureId,
|
||||
};
|
||||
use emath::*;
|
||||
use emath::{pos2, Align2, Pos2, Rangef, Rect, TSTransform, Vec2};
|
||||
|
||||
pub use crate::{CubicBezierShape, QuadraticBezierShape};
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::*;
|
||||
use crate::{
|
||||
color, CircleShape, Color32, ColorMode, CubicBezierShape, EllipseShape, Mesh, PathShape,
|
||||
QuadraticBezierShape, RectShape, Shape, TextShape,
|
||||
};
|
||||
|
||||
/// Remember to handle [`Color32::PLACEHOLDER`] specially!
|
||||
pub fn adjust_colors(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Collect statistics about what is being painted.
|
||||
|
||||
use crate::*;
|
||||
use crate::{ClippedShape, Galley, Mesh, Primitive, Shape};
|
||||
|
||||
/// Size of the elements in a vector/array.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
use super::*;
|
||||
use super::{emath, Color32, ColorMode, Pos2, Rect};
|
||||
|
||||
/// Describes the width and color of a line.
|
||||
///
|
||||
|
||||
@@ -6,8 +6,12 @@
|
||||
#![allow(clippy::identity_op)]
|
||||
|
||||
use crate::texture_atlas::PreparedDisc;
|
||||
use crate::*;
|
||||
use emath::*;
|
||||
use crate::{
|
||||
color, emath, stroke, CircleShape, ClippedPrimitive, ClippedShape, Color32, CubicBezierShape,
|
||||
EllipseShape, Mesh, PathShape, Primitive, QuadraticBezierShape, RectShape, Rounding, Shape,
|
||||
Stroke, TextShape, TextureId, Vertex, WHITE_UV,
|
||||
};
|
||||
use emath::{pos2, remap, vec2, NumExt, Pos2, Rect, Rot2, Vec2};
|
||||
|
||||
use self::color::ColorMode;
|
||||
use self::stroke::PathStroke;
|
||||
@@ -338,7 +342,7 @@ impl Path {
|
||||
}
|
||||
|
||||
pub fn add_circle(&mut self, center: Pos2, radius: f32) {
|
||||
use precomputed_vertices::*;
|
||||
use precomputed_vertices::{CIRCLE_128, CIRCLE_16, CIRCLE_32, CIRCLE_64, CIRCLE_8};
|
||||
|
||||
// These cutoffs are based on a high-dpi display. TODO(emilk): use pixels_per_point here?
|
||||
// same cutoffs as in add_circle_quadrant
|
||||
@@ -520,7 +524,7 @@ impl Path {
|
||||
pub mod path {
|
||||
//! Helpers for constructing paths
|
||||
use crate::shape::Rounding;
|
||||
use emath::*;
|
||||
use emath::{pos2, Pos2, Rect};
|
||||
|
||||
/// overwrites existing points
|
||||
pub fn rounded_rectangle(path: &mut Vec<Pos2>, rect: Rect, rounding: Rounding) {
|
||||
@@ -589,7 +593,7 @@ pub mod path {
|
||||
// - quadrant 3: right top
|
||||
// * angle 4 * TAU / 4 = right
|
||||
pub fn add_circle_quadrant(path: &mut Vec<Pos2>, center: Pos2, radius: f32, quadrant: f32) {
|
||||
use super::precomputed_vertices::*;
|
||||
use super::precomputed_vertices::{CIRCLE_128, CIRCLE_16, CIRCLE_32, CIRCLE_64, CIRCLE_8};
|
||||
|
||||
// These cutoffs are based on a high-dpi display. TODO(emilk): use pixels_per_point here?
|
||||
// same cutoffs as in add_circle
|
||||
@@ -1171,7 +1175,7 @@ pub struct Tessellator {
|
||||
options: TessellationOptions,
|
||||
font_tex_size: [usize; 2],
|
||||
|
||||
/// See [`TextureAtlas::prepared_discs`].
|
||||
/// See [`crate::TextureAtlas::prepared_discs`].
|
||||
prepared_discs: Vec<PreparedDisc>,
|
||||
|
||||
/// size of feathering in points. normally the size of a physical pixel. 0.0 if disabled
|
||||
@@ -1191,7 +1195,7 @@ impl Tessellator {
|
||||
/// * `options`: tessellation quality
|
||||
/// * `shapes`: what to tessellate
|
||||
/// * `font_tex_size`: size of the font texture. Required to normalize glyph uv rectangles when tessellating text.
|
||||
/// * `prepared_discs`: What [`TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec.
|
||||
/// * `prepared_discs`: What [`crate::TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec.
|
||||
pub fn new(
|
||||
pixels_per_point: f32,
|
||||
options: TessellationOptions,
|
||||
@@ -1902,7 +1906,7 @@ impl Tessellator {
|
||||
/// * `options`: tessellation quality
|
||||
/// * `shapes`: what to tessellate
|
||||
/// * `font_tex_size`: size of the font texture. Required to normalize glyph uv rectangles when tessellating text.
|
||||
/// * `prepared_discs`: What [`TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec.
|
||||
/// * `prepared_discs`: What [`crate::TextureAtlas::prepared_discs`] returns. Can safely be set to an empty vec.
|
||||
///
|
||||
/// The implementation uses a [`Tessellator`].
|
||||
///
|
||||
|
||||
@@ -92,7 +92,7 @@ impl FontImpl {
|
||||
assert!(scale_in_pixels > 0.0);
|
||||
assert!(pixels_per_point > 0.0);
|
||||
|
||||
use ab_glyph::*;
|
||||
use ab_glyph::{Font, ScaleFont};
|
||||
let scaled = ab_glyph_font.as_scaled(scale_in_pixels);
|
||||
let ascent = scaled.ascent() / pixels_per_point;
|
||||
let descent = scaled.descent() / pixels_per_point;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::ops::RangeInclusive;
|
||||
use std::sync::Arc;
|
||||
|
||||
use emath::*;
|
||||
use emath::{pos2, vec2, Align, NumExt, Pos2, Rect, Vec2};
|
||||
|
||||
use crate::{stroke::PathStroke, text::font::Font, Color32, Mesh, Stroke, Vertex};
|
||||
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::{cursor::*, font::UvRect};
|
||||
use super::{
|
||||
cursor::{CCursor, Cursor, PCursor, RCursor},
|
||||
font::UvRect,
|
||||
};
|
||||
use crate::{Color32, FontId, Mesh, Stroke};
|
||||
use emath::*;
|
||||
use emath::{pos2, vec2, Align, NumExt, OrderedFloat, Pos2, Rect, Vec2};
|
||||
|
||||
/// Describes the task of laying out text.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user