Skip to content

Commit

Permalink
Fix anti-patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Oct 14, 2024
1 parent ff90e8a commit df03a49
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion archived/rustry/examples/future_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn read_line() -> io::Result<String> {

let input = io::stdin();
let mut locked = input.lock();
let mut buf = String::new();
let mut buf = String::default();

match locked.read_line(&mut buf) {
Ok(_) => Ok(buf),
Expand Down
2 changes: 1 addition & 1 deletion yard-rs/lists/src/list01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl List {

pub fn push(&mut self, elem: i32) {
let new_node = Box::new(Node {
elem: elem,
elem,
next: mem::replace(&mut self.head, Link::Empty),
});

Expand Down
2 changes: 1 addition & 1 deletion yard-rs/lists/src/list02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<T> List<T> {

pub fn push(&mut self, elem: T) {
let new_node = Box::new(Node {
elem: elem,
elem,
next: self.head.take(),
});

Expand Down
10 changes: 5 additions & 5 deletions yard-rs/runpod-xp/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def run(

if runpod_cfg.debug:
os.environ["RUNPOD_DEBUG"] = 'true'
logging.info(f"Debug mode enabled")
logging.info("Debug mode enabled")

try:
if runpod_cfg.pod_type == 'INTERRUPTABLE':
Expand Down Expand Up @@ -187,7 +187,7 @@ def run(
log_error(f"Failed to create pod for {config}")
return

def signal_handler(signal, frame):
def signal_handler(_signal, _frame):
logging.info(f"Keyboard interrupt received, terminating pod {pod['id']}")
terminate(pod)
sys.exit(0)
Expand All @@ -208,9 +208,9 @@ def signal_handler(signal, frame):

eta = CUSTOM_RUNPOD_IMAGE_SIZE * BITS_PER_BYTE / pod_info['machine']['maxDownloadSpeedMbps'] + CUSTOM_RUNPOD_IMAGE_SIZE / COMPRESSION_RATIO / pod_info['machine']['diskMBps']

logging.info(f" - Estimated time to download and extrace the image: {eta} seconds")
logging.info(f" - While you're waiting, you can check the status of the pod at https://www.runpod.io/console/pods ")
logging.info(f" - After started, use the following command to ssh into the pod: {ssh_command}")
logging.info(" - Estimated time to download and extrace the image: {eta} seconds")
logging.info(" - While you're waiting, you can check the status of the pod at https://www.runpod.io/console/pods ")
logging.info(" - After started, use the following command to ssh into the pod: {ssh_command}")
# logging.info(f" or the following command in CodeSpace: {codespace_ssh_command}")

runtime = None
Expand Down
4 changes: 2 additions & 2 deletions yard-rs/rust_basics/examples/stdin.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::io;

fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).ok().unwrap_or_default();
let mut input = String::default();
io::stdin().read_line(&mut input).unwrap_or_default();
println!(
"{}",
input
Expand Down

0 comments on commit df03a49

Please sign in to comment.