Remove wildcard imports from source files - #14
Merged
Conversation
Replace wildcard imports (use module::*) with explicit imports in the following files: - src/roots.rs - src/round.rs - src/gauss.rs - src/circular.rs - src/exp.rs - src/hyperbolic.rs - src/traits.rs - src/lib.rs (also remove unused import) Test modules required minimal additional imports where functions were previously available through wildcard imports but are now explicitly imported only in production code. Test module wildcard imports (use super::*) are intentionally kept as they are considered acceptable in Rust best practices. Resolves tuwien-cms#11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The codebase uses wildcard imports (
use module::*) extensively in production code, which makes it difficult to understand where symbols come from and can lead to name collisions. This was reported in #11.The Rust language design team recommends using explicit imports for better code readability and maintainability, reserving wildcard imports only for preludes and test modules.
Solution
src/roots.rs- explicit imports fromarithmodulesrc/round.rs- explicit imports fromarithmodulesrc/gauss.rs- explicit imports fromarithandcircularmodulessrc/circular.rs- explicit imports fromarith,checks,funcs, andutilsmodulessrc/exp.rs- explicit imports from multiple modulessrc/hyperbolic.rs- explicit imports fromarith,checks,exp,funcs, androotsmodulessrc/traits.rs- explicit imports fromstd::ops,num_traits, andsimba::scalarsrc/lib.rs- removed unusednum_traits::Zeroimportuse super::*;) are intentionally kept as they are considered acceptable in Rust best practicesTesting
Impact
This change improves code readability by making it clear where each imported symbol comes from, making the codebase easier to understand and maintain.
Resolves #11