Skip to content

Fix The PNG > BRUH won't work#7

Open
neoapps-dev wants to merge 2 commits into
face-hh:mainfrom
neoapps-dev:patch-1
Open

Fix The PNG > BRUH won't work#7
neoapps-dev wants to merge 2 commits into
face-hh:mainfrom
neoapps-dev:patch-1

Conversation

@neoapps-dev
Copy link
Copy Markdown

@neoapps-dev neoapps-dev commented Aug 14, 2024

i only fixed the issue:
⚠ The PNG > BRUH won't work unless you have the same file (i.e. image.png) but with the .bruh extension (i.e. image.bruh). What do you have to do? Create an empty file called image.bruh.

||(i haven't tested it out yet because my windows laptop has issues with rust somehow)||

Summary by CodeRabbit

  • Bug Fixes
    • Improved file handling to ensure the output file is properly created or truncated before writing.

@neoapps-dev
Copy link
Copy Markdown
Author

Still not merged lmfao

@neoapps-dev
Copy link
Copy Markdown
Author

bruh

Copy link
Copy Markdown

@johnzhou721 johnzhou721 left a comment

Choose a reason for hiding this comment

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

Looks good to me but me only.

@johnzhou721
Copy link
Copy Markdown

bruh

Pun intended?

@neoapps-dev
Copy link
Copy Markdown
Author

bruh

Pun intended?

yep. lmao

@johnzhou721
Copy link
Copy Markdown

bruh

Pun intended?

yep. lmao

Cursing is bad... just fyi

@neoapps-dev
Copy link
Copy Markdown
Author

bruh

Pun intended?

yep. lmao

Cursing is bad... just fyi

lmao what

@neoapps-dev
Copy link
Copy Markdown
Author

@face-hh when merge 🗿

@johnzhou721
Copy link
Copy Markdown

bruh

Pun intended?

yep. lmao

Cursing is bad... just fyi

lmao what

lm BAD WORD HERE o

This is trivial.

Comment thread main.rs Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 11, 2025

Walkthrough

An explicit import of std::fs::File was added, and the png_to_bruh function now calls File::create(path_to_bruh)? before opening the file with OpenOptions. This ensures the target file exists or is truncated prior to writing. No other logic or public interfaces were changed.

Changes

File(s) Change Summary
main.rs Added import of std::fs::File; inserted File::create call in png_to_bruh before writing to file.

Poem

A file is born with a single hop,
Created before the writing won't stop.
With careful paws, the code now checks—
No missing files or writing wrecks!
In burrows deep, our data's safe,
Thanks to a bunny, clever and brave. 🐇

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Clippy (1.86.0)
Updating crates.io index

warning: failed to write cache, path: /usr/local/registry/index/index.crates.io-1949cf8c6b5b557f/.cache/ba/se/base64, error: Permission denied (os error 13)
Downloading crates ...
Downloaded ab_glyph v0.2.21
error: failed to create directory /usr/local/registry/cache/index.crates.io-1949cf8c6b5b557f

Caused by:
Permission denied (os error 13)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
main.rs (1)

61-67: Refactor file creation to be more efficient and consistent.

The current approach creates a file handle and immediately discards it, then opens the same file again with OpenOptions. This is inefficient and could cause issues on some systems.

Solution 1 (Recommended): Use the created file handle directly

-        File::create(path_to_bruh)?;
-
-        let mut file = OpenOptions::new()
-            .write(true)
-            .create(true)
-            .open(path_to_bruh)
-            .expect("Couldnt write");
+        let mut file = File::create(&path_to_bruh)?;

Solution 2: Add truncate to OpenOptions

-        File::create(path_to_bruh)?;
-
         let mut file = OpenOptions::new()
             .write(true)
             .create(true)
+            .truncate(true)
-            .open(path_to_bruh)
-            .expect("Couldnt write");
+            .open(&path_to_bruh)?;

Note: Solution 1 is preferred as it's more concise and maintains consistent error handling with the ? operator.

🧹 Nitpick comments (1)
main.rs (1)

60-60: Improve path manipulation robustness.

Using simple string replacement for file extensions can be unreliable if the filename contains ".png" in unexpected places.

Consider using Path methods for more robust extension handling:

-        let path_to_bruh = path_str.replace(".png", ".bruh");
+        let path_to_bruh = path.with_extension("bruh");

This would require updating the subsequent file operations to work with PathBuf instead of String, which is more type-safe.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0ff09c and 1c1047f.

📒 Files selected for processing (1)
  • main.rs (3 hunks)
🔇 Additional comments (1)
main.rs (1)

17-17: Import is correctly used.

The import is used on line 61, so it's necessary and appropriate.

Comment thread main.rs
@neoapps-dev
Copy link
Copy Markdown
Author

@face-hh cmon man

@RajnishKMehta
Copy link
Copy Markdown

bruh

Pun intended?

yep. lmao

Cursing is bad... just fyi

lmao what

lm BAD WORD HERE o

This is trivial.

brushhhhhh

@snoopythe3-from-scratch
Copy link
Copy Markdown

snoopythe3-from-scratch commented May 4, 2026 via email

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