diff --git a/src/api.rs b/src/api.rs index b589c25..0152a2f 100644 --- a/src/api.rs +++ b/src/api.rs @@ -33,6 +33,7 @@ pub struct IntermediaryTag { name: String, } +// TODO: actual error handling pub fn get_tags(repo: &str, owner: &str) -> Result { let tags = query_tags(repo, owner).unwrap(); Ok(tags.into()) diff --git a/src/bin/flake-edit/app.rs b/src/bin/flake-edit/app.rs index 07f3856..8685d91 100644 --- a/src/bin/flake-edit/app.rs +++ b/src/bin/flake-edit/app.rs @@ -31,28 +31,19 @@ impl FlakeEdit { pub fn root(&self) -> &FlakeBuf { &self.root } - - pub fn run(&self) -> Result<(), FeError> { - Ok(()) - } } #[derive(Debug, Default)] pub struct FlakeBuf { text: Rope, path: String, - dirty: bool, } impl FlakeBuf { fn from_path(path: PathBuf) -> io::Result { let text = Rope::from_reader(&mut io::BufReader::new(File::open(&path)?))?; let path = path.display().to_string(); - Ok(Self { - text, - path, - dirty: false, - }) + Ok(Self { text, path }) } pub fn text(&self) -> &Rope { diff --git a/src/bin/flake-edit/cli.rs b/src/bin/flake-edit/cli.rs index f3dac91..7bb046c 100644 --- a/src/bin/flake-edit/cli.rs +++ b/src/bin/flake-edit/cli.rs @@ -138,9 +138,6 @@ impl From for CompletionMode { } } -#[derive(Debug, Clone)] -pub(crate) enum Parameter {} - #[derive(Debug, Clone, Default)] pub(crate) enum ListFormat { None, diff --git a/src/bin/flake-edit/main.rs b/src/bin/flake-edit/main.rs index befa546..0d0f425 100644 --- a/src/bin/flake-edit/main.rs +++ b/src/bin/flake-edit/main.rs @@ -12,7 +12,6 @@ use flake_edit::change::Change; use flake_edit::diff::Diff; use flake_edit::edit; use flake_edit::input::Follows; -use flake_edit::input::Input; use flake_edit::update::Updater; use nix_uri::urls::UrlWrapper; use nix_uri::{FlakeRef, NixUriResult}; @@ -120,17 +119,6 @@ fn main() -> eyre::Result<()> { std::process::exit(0); } }, - Command::Add { - id, - uri, - ref_or_rev, - force, - no_flake, - } => todo!(), - Command::Pin { id } => todo!(), - Command::Change { id, uri } => todo!(), - Command::Remove { id } => todo!(), - Command::Completion { inputs, mode } => todo!(), } if let Ok(Some(resulting_change)) = editor.apply_change(change.clone()) { diff --git a/src/input.rs b/src/input.rs index 6fc6d26..c0c37bf 100644 --- a/src/input.rs +++ b/src/input.rs @@ -33,29 +33,6 @@ pub enum Follows { Direct(String, Input), } -impl Follows {} - -#[derive(Debug, Default)] -pub(crate) struct FollowsBuilder { - attrs: Vec, -} - -impl FollowsBuilder { - pub(crate) fn push_str(&mut self, attr: &str) -> Option { - self.attrs.push(attr.to_owned()); - if self.attrs.len() == 4 { - Some(self.build()) - } else { - None - } - } - fn build(&self) -> Follows { - let from = self.attrs.get(1).unwrap(); - let to = self.attrs.get(3).unwrap(); - Follows::Indirect(from.to_owned(), to.to_owned()) - } -} - impl Default for Input { fn default() -> Self { Self { diff --git a/src/lib.rs b/src/lib.rs index 682f184..daa18a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,6 @@ pub mod diff; pub mod edit; pub mod error; pub mod input; -mod semver; pub mod state; pub mod update; pub mod walk; diff --git a/src/semver.rs b/src/semver.rs deleted file mode 100644 index c794222..0000000 --- a/src/semver.rs +++ /dev/null @@ -1,11 +0,0 @@ -use semver::Version; - -pub struct Semver { - version: semver::Version, -} - -impl Semver { - pub fn new(version: semver::Version) -> Self { - Self { version } - } -} diff --git a/src/update.rs b/src/update.rs index 9771889..a58f396 100644 --- a/src/update.rs +++ b/src/update.rs @@ -40,7 +40,6 @@ impl Updater { } pub fn change_input(&mut self, input: &UpdateInput) { - let change = input.update(); let uri = self .text .slice( @@ -53,10 +52,12 @@ impl Updater { let mut maybe_version = String::new(); let is_params = &parsed.params.get_ref().is_some(); - if let nix_uri::FlakeRefType::GitHub { ref_or_rev, .. } = &parsed.r#type { - if let Some(ref_or_rev) = ref_or_rev { - maybe_version = ref_or_rev.into(); - } + if let nix_uri::FlakeRefType::GitHub { + ref_or_rev: Some(ref_or_rev), + .. + } = &parsed.r#type + { + maybe_version = ref_or_rev.into(); } if let Some(r#ref) = &parsed.params.get_ref() { maybe_version = r#ref.to_string(); @@ -147,9 +148,3 @@ impl PartialOrd for UpdateInput { } impl Eq for UpdateInput {} - -impl UpdateInput { - fn update(&self) -> &str { - "1.3.4" - } -} diff --git a/src/walk.rs b/src/walk.rs index 0368b92..833f8ea 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -298,6 +298,7 @@ impl<'a> Walker { /// - description /// - inputs /// - outputs + #[allow(clippy::option_map_unit_fn)] fn walk_toplevel( &mut self, node: SyntaxNode,