Skip to content

Conversation

@AlexWaygood
Copy link
Member

Summary

This PR removes the From<Type> implementations for Symbol and SymbolAndQualifiers, replacing them with smart constructors. This has a few advantages:

  • It's easier to see when reading the code what (Rust) type the variable is being turned into, compared to a .into() call
  • It's more explicit that we're creating symbols with Boundness::Bound
  • In some cases, it's more concise

Test Plan

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Feb 10, 2025
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is a bit clearer for the reader.

@AlexWaygood AlexWaygood enabled auto-merge (squash) February 11, 2025 11:06
@AlexWaygood AlexWaygood merged commit df1d430 into main Feb 11, 2025
20 checks passed
@AlexWaygood AlexWaygood deleted the alex/simplify-symbol-usage branch February 11, 2025 11:09
dcreager added a commit that referenced this pull request Feb 11, 2025
* main:
  add diagnostic `Span` (couples `File` and `TextRange`) (#16101)
  Remove `Hash` and `Eq` from `AstNodeRef` for types not implementing `Eq` or `Hash` (#16100)
  Fix release build warning about unused todo type message (#16102)
  [`pydocstyle`] Handle arguments with the same names as sections (`D417`) (#16011)
  [red-knot] Reduce usage of `From<Type>` implementations when working with `Symbol`s (#16076)
  Transition to salsa coarse-grained tracked structs (#15763)
  [`pyupgrade`] Handle micro version numbers correctly (`UP036`) (#16091)
  [red-knot] `T | object == object` (#16088)
  [`ruff`] Skip singleton starred expressions for `incorrectly-parenthesized-tuple-in-subscript` (`RUF031`) (#16083)
  Delete left-over `verbosity.rs (#16081)
  [red-knot] User-level configuration (#16021)
  Add `user_configuration_directory` to `System` (#16020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants