Skip to content

Commit 9328817

Browse files
committed
reduce clone usage, remove nixpkg patch, bump poise
1 parent 1c5ba1a commit 9328817

7 files changed

Lines changed: 20 additions & 157 deletions

File tree

268075-nixpkgs.patch

Lines changed: 0 additions & 131 deletions
This file was deleted.

Cargo.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ serde = { version = "1.0", features = ["derive"] }
1212
serde_json = { version = "1.0" }
1313

1414
# Discord API
15-
poise = { git = "https://github.com/serenity-rs/poise.git", branch = "current" }
15+
poise = "0.6.1-rc1"
1616
serenity = {version = "0.12", default-features = false, features = ["cache", "client", "gateway", "rustls_backend", "model", "framework", "standard_framework"] }
1717
tokio = { version = "1.29.1", features = ["macros", "signal", "rt-multi-thread"] }
1818

default.nix

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,5 @@ rustPlatform.buildRustPackage rec {
2222

2323
cargoLock = {
2424
lockFile = ./Cargo.lock;
25-
outputHashes = {
26-
"poise-0.5.7" = "sha256-vI4FgRorQyv2FcrHI/hE6v/ISTAxOnenIQlt/mFQ4so=";
27-
};
2825
};
2926
}

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@
1111

1212
importPkgs = pkgs: import pkgs { inherit system; };
1313

14-
patchedPkgs = (importPkgs nixpkgs).applyPatches {
15-
name = "nixpkgs-patched";
16-
src = nixpkgs;
17-
patches = [ ./268075-nixpkgs.patch ];
14+
pkgs = import nixpkgs {
15+
inherit system;
16+
config.allowUnfree = true;
1817
};
1918

20-
pkgs = importPkgs patchedPkgs;
21-
2219
in rec {
2320

2421
packages.${system} = rec {

src/commands/snippets.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ pub async fn create_snippet(
6363
#[description = "The snippet's title"] title: String,
6464
#[description = "The snippet's content"] content: String,
6565
) -> Result<(), Error> {
66-
// I really don't like the code I wrote here.
6766
let embed = {
6867
let mut rwlock_guard = ctx.data().state.write().unwrap();
6968

@@ -72,20 +71,19 @@ pub async fn create_snippet(
7271
}
7372

7473
let snippet = Snippet {
75-
id: id.clone(),
76-
title: title.clone(),
74+
id,
75+
title,
7776
content: content.replace(r"\n", "\n"),
7877
};
7978

80-
rwlock_guard.snippets.push(snippet.clone());
81-
82-
rwlock_guard.snippets = rwlock_guard.snippets.clone();
83-
println!("New snippet created '{}: {}'", id, title);
84-
rwlock_guard.write();
85-
79+
println!("New snippet created '{}: {}'", snippet.id, snippet.title);
8680
let mut embed = snippet.embed();
81+
8782
embed = embed.colour(super::OK_COLOUR);
8883

84+
rwlock_guard.snippets.push(snippet);
85+
rwlock_guard.write();
86+
8987
if rwlock_guard.snippets.len() > 25 {
9088
embed = embed.field(
9189
"Warning",

0 commit comments

Comments
 (0)