Skip to content

minor: remove unused variables #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2020
Merged

Conversation

saghm
Copy link
Contributor

@saghm saghm commented Jun 24, 2020

It appears that we accidentally never removed the project-wide annotation to suppress unused variable warnings, so I removed it and fixed all the issues. Fortunately, almost all of these were not indicators of bugs; the one exception was a very minor bug in handshake metadata logic for libraries wrapping the driver, where we accidentally appended the platform name to the driver's version string instead of the platform string (but with the proper delimiter, so this likely didn't break anything).

@saghm saghm force-pushed the remove-unused-variables branch from ea2a5a7 to 174de2b Compare June 24, 2020 17:43
@@ -55,13 +52,13 @@ impl Monitor {
.heartbeat_freq
.unwrap_or(DEFAULT_HEARTBEAT_FREQUENCY);

while let Some(server) = self.server.upgrade() {
while let Some(_server) = self.server.upgrade() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to make sure we can upgrade the weak reference to the server to a strong reference, since being unable to indicates that the server was dropped from the cluster, but we don't actually need the server itself for the body of the loop.

@@ -254,8 +254,6 @@ impl Topology {
// references to the same instances though, since each is wrapped in an `Arc`.
let mut state_clone = self.state.read().await.clone();

let old_description = state_clone.description.clone();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We call update_state to do the work of replacing the topology state, which handles replacing the description and starting the new monitoring threads without needing the old description, so this dead code doesn't represent any missing logic, but rather an unnecessary variable.

@saghm saghm marked this pull request as ready for review June 24, 2020 17:48
@mongodb mongodb deleted a comment from saghm Jun 24, 2020
@saghm saghm merged commit 6b74f93 into mongodb:master Jun 24, 2020
@saghm saghm deleted the remove-unused-variables branch June 24, 2020 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants