You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR set the Rust compiler version to 1.89.0 in WORKSPACE. This will allow us to use the latest features of the Rust language. This PR also contains some smell-fixes only possible with this version.
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
Update
PR Type
Enhancement
Description
Update Rust compiler version to 1.89.0 in WORKSPACE
Refactor conditional logic using modern Rust syntax
Replace deprecated method calls with newer alternatives
Switch linker from gold to lld in build configuration
Diagram Walkthrough
flowchart LR
A["WORKSPACE"] -- "update version" --> B["Rust 1.89.0"]
B -- "enables" --> C["Modern Syntax"]
C -- "refactor" --> D["Conditional Logic"]
C -- "update" --> E["Method Calls"]
F["Build Config"] -- "switch linker" --> G["lld"]
Loading
File Walkthrough
Relevant files
Configuration changes
WORKSPACE
Set Rust version to 1.89.0
WORKSPACE
Update Rust toolchain version from default to 1.89.0
Below is a summary of compliance checks for this PR:
Security Compliance
⚪
Panic on unwrap
Description: Calling selenium_manager.find_best_driver_from_cache().unwrap() inside error handling can panic on None/Err, potentially turning a recoverable failure into a crash and enabling denial-of-service via triggering this path. main.rs [258-276]
Referred Code
&& let Some(best_driver_from_cache) =
selenium_manager.find_best_driver_from_cache().unwrap(){
log.debug_or_warn(format!("There was an error managing {} ({}); using driver found in the cache",
selenium_manager.get_driver_name(),
err
),
selenium_manager.is_offline(),);log_driver_and_browser_path(
log,&best_driver_from_cache,&selenium_manager.get_browser_path_or_latest_from_cache(),
selenium_manager.get_receiver(),);flush_and_exit(OK, log,Some(err));}
Unsafe file deletion
Description: Deleting a filesystem path from get_lock_path() without validating that it resides in an expected directory could allow unintended file deletion if the path is manipulated elsewhere. lock.rs [73-77]
Investigate and resolve "Error: ConnectFailure (Connection refused)" occurring after the first ChromeDriver instantiation on Ubuntu 16.04 with Chrome 65 and ChromeDriver 2.35 (Selenium 3.9.0).
Provide a reliable fix or mitigation so subsequent ChromeDriver instances do not log the connection failure.
Ideally include steps or code changes that address repeated instantiation behavior.
Replace .unwrap() with let Ok(Some(...)) pattern matching to safely handle the Result from find_best_driver_from_cache() and prevent a potential panic in the error handler.
if selenium_manager.is_fallback_driver_from_cache()
- && let Some(best_driver_from_cache) =- selenium_manager.find_best_driver_from_cache().unwrap()+ && let Ok(Some(best_driver_from_cache)) = selenium_manager.find_best_driver_from_cache()
{
log.debug_or_warn(
format!(
"There was an error managing {} ({}); using driver found in the cache",
selenium_manager.get_driver_name(),
err
),
selenium_manager.is_offline(),
);
log_driver_and_browser_path(
log,
&best_driver_from_cache,
&selenium_manager.get_browser_path_or_latest_from_cache(),
selenium_manager.get_receiver(),
);
flush_and_exit(OK, log, Some(err));
}
Apply / Chat
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a potential panic caused by .unwrap() within an error handling block, which would crash the program instead of handling the error gracefully.
Medium
Learned best practice
Robustly extract filename segment
Avoid taking a mutable segments for a single next_back() call and guard for trailing slashes explicitly. Use rsplit('/') on the path string to robustly extract the last non-empty segment.
Why:
Relevant best practice - Validate inputs and states early to avoid logic errors; ensure iterator usage matches expected type and handles empty paths robustly.
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
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.
User description
🔗 Related Issues
💥 What does this PR do?
This PR set the Rust compiler version to 1.89.0 in WORKSPACE. This will allow us to use the latest features of the Rust language. This PR also contains some smell-fixes only possible with this version.
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement
Description
Update Rust compiler version to 1.89.0 in WORKSPACE
Refactor conditional logic using modern Rust syntax
Replace deprecated method calls with newer alternatives
Switch linker from gold to lld in build configuration
Diagram Walkthrough
File Walkthrough
WORKSPACE
Set Rust version to 1.89.0WORKSPACE
BUILD
Update linker configurationcommon/remote-build/cc/BUILD
downloads.rs
Update iterator method callrust/src/downloads.rs
last()withnext_back()methodlib.rs
Modernize conditional logic with let-chainsrust/src/lib.rs
lock.rs
Refactor lock handling with let-chainsrust/src/lock.rs
main.rs
Modernize error handling syntaxrust/src/main.rs