diff --git a/Cargo.toml b/Cargo.toml
index 186f6d8..d55bb8a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -128,7 +128,7 @@ path = "src/bin/rust-strip.rs"
 version = "1.0"
 
 [dependencies.cargo_metadata]
-version = "0.18.1"
+version = "0.23"
 
 [dependencies.clap]
 version = "4.4.8"
diff --git a/src/lib.rs b/src/lib.rs
index acad687..449f04d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,7 +5,7 @@ use std::{env, str};
 
 use anyhow::{bail, Result};
 use cargo_metadata::camino::Utf8Component;
-use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand};
+use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand, TargetKind};
 use clap::{Arg, ArgAction, ArgMatches, Command as ClapCommand};
 use rustc_cfg::Cfg;
 
@@ -133,10 +133,10 @@ impl BuildType<'_> {
                 .target
                 .kind
                 .iter()
-                .any(|s| s == "bin" || s == "example"),
+                .any(|s| s == &TargetKind::Bin || s == &TargetKind::Example),
             // Since LibKind can be an arbitrary string `LibKind:Other(String)` we filter by what it can't be
             BuildType::Lib => artifact.target.kind.iter().any(|s| {
-                s != "bin" && s != "example" && s != "test" && s != "custom-build" && s != "bench"
+		s != &TargetKind::Bin && s != &TargetKind::Example && s != &TargetKind::Test && s != &TargetKind::CustomBuild && s != &TargetKind::Bench
             }),
         }
     }
